Package com.trilead.ssh2.crypto
Class PEMDecoder
java.lang.Object
com.trilead.ssh2.crypto.PEMDecoder
PEM Support.
- Version:
- $Id: PEMDecoder.java,v 1.2 2008/04/01 12:38:09 cplattne Exp $
- Author:
- Christian Plattner, plattner@trilead.com
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Object
Deprecated.use PEMDecoder.decodeKeyPairstatic KeyPair
decodeKeyPair
(char[] pem, String password) Extract a key pair from a PEM file.static void
decryptPEM
(PEMStructure ps, String password) Decrypt a key in a PEMStructure and store the unencrypted key decrypted in the PEMStructure.static byte[]
hexToByteArray
(String hex) convert an hexadecimal number in a string to its bytes.static boolean
Check if a Key is encrypted.static PEMStructure
parsePEM
(char[] pem) Process a PEM file and construct a PEMStructure.
-
Constructor Details
-
PEMDecoder
public PEMDecoder()
-
-
Method Details
-
hexToByteArray
convert an hexadecimal number in a string to its bytes.- Parameters:
hex
- hexadecimal number in a string.- Returns:
- Array of bytes.
-
parsePEM
Process a PEM file and construct a PEMStructure. It works with RSA and DSA keys.- Parameters:
pem
- PEM file content.- Returns:
- PEMStructure with the PEM file data parsed.
- Throws:
IOException
-
decryptPEM
Decrypt a key in a PEMStructure and store the unencrypted key decrypted in the PEMStructure.- Parameters:
ps
- PEMStructure structure to load the PEM data.password
- password to decrypt the Key.- Throws:
IOException
-
isPEMEncrypted
Check if a Key is encrypted.- Parameters:
ps
- PEMStructure structure to load the PEM data.- Returns:
- true if it is encrypted.
- Throws:
IOException
-
decode
Deprecated.use PEMDecoder.decodeKeyPairreturn a RSA or a DSA Key from a PEM data.- Throws:
IOException
-
decodeKeyPair
Extract a key pair from a PEM file.- Parameters:
pem
- PEMStructure structure to load the PEM data.password
- password to decrypt the Key.- Returns:
- keypair from the PEM file.
- Throws:
IOException
-