ch.ethz.ssh2.crypto
Class PEMDecoder

java.lang.Object
  extended bych.ethz.ssh2.crypto.PEMDecoder

public class PEMDecoder
extends java.lang.Object

PEM Support.

Version:
$Id: PEMDecoder.java,v 1.7 2006/02/02 09:11:03 cplattne Exp $
Author:
Christian Plattner, plattner@inf.ethz.ch

Field Summary
private static int PEM_DSA_PRIVATE_KEY
           
private static int PEM_RSA_PRIVATE_KEY
           
 
Constructor Summary
PEMDecoder()
           
 
Method Summary
static java.lang.Object decode(char[] pem, java.lang.String password)
           
private static void decryptPEM(PEMStructure ps, byte[] pw)
           
private 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 byte[] removePadding(byte[] buff, int blockSize)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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
Constructor Detail

PEMDecoder

public PEMDecoder()
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