Package com.trilead.ssh2.crypto
Class PEMDecoder
- java.lang.Object
-
- com.trilead.ssh2.crypto.PEMDecoder
-
public class PEMDecoder extends java.lang.Object
PEM Support.- Version:
- $Id: PEMDecoder.java,v 1.2 2008/04/01 12:38:09 cplattne Exp $
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.logging.Logger
LOGGER
private static int
PEM_DSA_PRIVATE_KEY
private static int
PEM_RSA_PRIVATE_KEY
-
Constructor Summary
Constructors Constructor Description PEMDecoder()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static java.lang.Object
decode(char[] pem, java.lang.String password)
Deprecated.static java.security.KeyPair
decodeKeyPair(char[] pem, java.lang.String password)
private static void
decryptPEM(PEMStructure ps, byte[] pw)
static byte[]
generateKeyFromPasswordSaltWithMD5(byte[] password, byte[] salt, int keyLen)
private static byte[]
hexToByteArray(java.lang.String hex)
private static int
hexToInt(char c)
static boolean
isPEMEncrypted(PEMStructure ps)
private static PEMStructure
parsePEM(char[] pem)
private static PEMStructure
parsePEM(char[] pem, CertificateDecoder certificateDecoder)
private static byte[]
removePadding(byte[] buff, int blockSize)
-
-
-
Field Detail
-
LOGGER
private static final java.util.logging.Logger LOGGER
-
PEM_RSA_PRIVATE_KEY
private static final int PEM_RSA_PRIVATE_KEY
- See Also:
- Constant Field Values
-
PEM_DSA_PRIVATE_KEY
private static final int PEM_DSA_PRIVATE_KEY
- See Also:
- Constant Field Values
-
-
Method Detail
-
hexToInt
private static int hexToInt(char c)
-
hexToByteArray
private static byte[] hexToByteArray(java.lang.String hex)
-
generateKeyFromPasswordSaltWithMD5
public static byte[] generateKeyFromPasswordSaltWithMD5(byte[] password, byte[] salt, int keyLen) throws java.io.IOException
- Throws:
java.io.IOException
-
removePadding
private static byte[] removePadding(byte[] buff, int blockSize) throws java.io.IOException
- Throws:
java.io.IOException
-
parsePEM
private static PEMStructure parsePEM(char[] pem) throws java.io.IOException
- Throws:
java.io.IOException
-
parsePEM
private static PEMStructure parsePEM(char[] pem, CertificateDecoder certificateDecoder) throws java.io.IOException
- Throws:
java.io.IOException
-
decryptPEM
private static void decryptPEM(PEMStructure ps, byte[] pw) throws java.io.IOException
- Throws:
java.io.IOException
-
isPEMEncrypted
public static boolean isPEMEncrypted(PEMStructure ps) throws java.io.IOException
- Throws:
java.io.IOException
-
decode
@Deprecated public static java.lang.Object decode(char[] pem, java.lang.String password) throws java.io.IOException
Deprecated.- Throws:
java.io.IOException
-
decodeKeyPair
public static java.security.KeyPair decodeKeyPair(char[] pem, java.lang.String password) throws java.io.IOException
- Throws:
java.io.IOException
-
-