Package de.mhus.lib.core.crypt.pem
Class PemUtil
- java.lang.Object
-
- de.mhus.lib.core.crypt.pem.PemUtil
-
public class PemUtil extends Object
-
-
Constructor Summary
Constructors Constructor Description PemUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static PemPrivcipherPrivFromString(String str)static PemPubcipherPubFromString(String str)static byte[]decrypt(byte[] encoded, String algorithm, SecureString passphrase)static byte[]decrypt(PemBlock block, SecureString passphrase)static byte[]getBlockAsBytes(String entry)static StringgetBlockAsString(String entry)static booleanisCipher(PemBlock block)static booleanisContent(PemBlock block)static booleanisHash(PemBlock block)static booleanisPemBlock(String text)static booleanisPrivKey(PemBlock block)static booleanisPubKey(PemBlock block)static booleanisSign(PemBlock block)static PemBlockparse(String entry)static PemPrivsignPrivFromString(String str)static PemPubsignPubFromString(String str)static PemKeytoKey(SecureString key)static PemKeytoKey(String key)static StringtoLine(PemBlock key)static PrivateKeytoPrivateKey(PemBlock pem, SecureString passphrase)static PublicKeytoPublicKey(PemBlock pem)
-
-
-
Method Detail
-
signPrivFromString
public static PemPriv signPrivFromString(String str) throws Exception, de.mhus.lib.errors.NotSupportedException, IOException
- Throws:
Exceptionde.mhus.lib.errors.NotSupportedExceptionIOException
-
signPubFromString
public static PemPub signPubFromString(String str) throws de.mhus.lib.errors.NotSupportedException, IOException, ParseException
- Throws:
de.mhus.lib.errors.NotSupportedExceptionIOExceptionParseException
-
cipherPrivFromString
public static PemPriv cipherPrivFromString(String str) throws ParseException, de.mhus.lib.errors.NotSupportedException, IOException
- Throws:
ParseExceptionde.mhus.lib.errors.NotSupportedExceptionIOException
-
isPemBlock
public static boolean isPemBlock(String text)
-
cipherPubFromString
public static PemPub cipherPubFromString(String str) throws ParseException, de.mhus.lib.errors.NotSupportedException, IOException
- Throws:
ParseExceptionde.mhus.lib.errors.NotSupportedExceptionIOException
-
isCipher
public static boolean isCipher(PemBlock block)
-
isSign
public static boolean isSign(PemBlock block)
-
isHash
public static boolean isHash(PemBlock block)
-
isPrivKey
public static boolean isPrivKey(PemBlock block)
-
isPubKey
public static boolean isPubKey(PemBlock block)
-
isContent
public static boolean isContent(PemBlock block)
-
toKey
public static PemKey toKey(String key) throws ParseException
- Throws:
ParseException
-
toKey
public static PemKey toKey(SecureString key) throws ParseException
- Throws:
ParseException
-
parse
public static PemBlock parse(String entry) throws ParseException
- Throws:
ParseException
-
getBlockAsString
public static String getBlockAsString(String entry) throws ParseException
- Throws:
ParseException
-
getBlockAsBytes
public static byte[] getBlockAsBytes(String entry) throws ParseException
- Throws:
ParseException
-
toPrivateKey
public static PrivateKey toPrivateKey(PemBlock pem, SecureString passphrase)
-
decrypt
public static byte[] decrypt(PemBlock block, SecureString passphrase) throws Exception
- Throws:
Exception
-
decrypt
public static byte[] decrypt(byte[] encoded, String algorithm, SecureString passphrase) throws Exception- Throws:
Exception
-
-