Package com.trilead.ssh2.crypto
Class PEMDecoder
- java.lang.Object
-
- com.trilead.ssh2.crypto.PEMDecoder
-
public class PEMDecoder extends java.lang.ObjectPEM 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 intPEM_DSA_PRIVATE_KEYprivate static intPEM_RSA_PRIVATE_KEY
-
Constructor Summary
Constructors Constructor Description PEMDecoder()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Objectdecode(char[] pem, java.lang.String password)private static voiddecryptPEM(PEMStructure ps, byte[] pw)private static byte[]generateKeyFromPasswordSaltWithMD5(byte[] password, byte[] salt, int keyLen)private static byte[]hexToByteArray(java.lang.String hex)private static inthexToInt(char c)static booleanisPEMEncrypted(PEMStructure ps)private static PEMStructureparsePEM(char[] pem)private static byte[]removePadding(byte[] buff, int blockSize)
-
-
-
Field Detail
-
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 final int hexToInt(char c)
-
hexToByteArray
private static byte[] hexToByteArray(java.lang.String hex)
-
generateKeyFromPasswordSaltWithMD5
private 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 final PEMStructure parsePEM(char[] pem) throws java.io.IOException
- Throws:
java.io.IOException
-
decryptPEM
private static final void decryptPEM(PEMStructure ps, byte[] pw) throws java.io.IOException
- Throws:
java.io.IOException
-
isPEMEncrypted
public static final boolean isPEMEncrypted(PEMStructure ps) throws java.io.IOException
- Throws:
java.io.IOException
-
decode
public static java.lang.Object decode(char[] pem, java.lang.String password) throws java.io.IOException- Throws:
java.io.IOException
-
-