edu.emory.mathcs.util.security
Class KeyUtils

java.lang.Object
  extended byedu.emory.mathcs.util.security.KeyUtils

public class KeyUtils
extends java.lang.Object

Utility methods to generate and manipulate keys.

Version:
1.0
Author:
Dawid Kurzyniec
See Also:
Key, KeyPair

Method Summary
static java.security.PublicKey decodeDSAPublicKey(byte[] encoded)
          Decodes the DSA public key out of its X.509 encoding.
static java.security.PublicKey decodeRSAPublicKey(byte[] encoded)
          Decodes the RSA public key out of its X.509 encoding.
static java.security.KeyPair generateDSAKeyPair()
          Generates an 1024-bit DSA key pair.
static java.security.KeyPair generateDSAKeyPair(int keysize)
          Generates DSA key pair of the specified size.
static java.security.KeyPair generateRSAKeyPair()
          Generates an 1024-bit RSA key pair.
static java.security.KeyPair generateRSAKeyPair(int keysize)
          Generates RSA key pair of the specified size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

generateRSAKeyPair

public static java.security.KeyPair generateRSAKeyPair()
Generates an 1024-bit RSA key pair.

Returns:
newly generated RSA key pair.

generateRSAKeyPair

public static java.security.KeyPair generateRSAKeyPair(int keysize)
Generates RSA key pair of the specified size.

Parameters:
keysize - the RSA key size
Returns:
newly generated RSA key pair.

decodeRSAPublicKey

public static java.security.PublicKey decodeRSAPublicKey(byte[] encoded)
Decodes the RSA public key out of its X.509 encoding.

Parameters:
encoded - X.509 encoding of an RSA public key
Returns:
the decoded public key

generateDSAKeyPair

public static java.security.KeyPair generateDSAKeyPair()
Generates an 1024-bit DSA key pair.

Returns:
newly generated DSA key pair.

generateDSAKeyPair

public static java.security.KeyPair generateDSAKeyPair(int keysize)
Generates DSA key pair of the specified size.

Parameters:
keysize - the DSA key size
Returns:
newly generated DSA key pair.

decodeDSAPublicKey

public static java.security.PublicKey decodeDSAPublicKey(byte[] encoded)
Decodes the DSA public key out of its X.509 encoding.

Parameters:
encoded - X.509 encoding of an DSA public key
Returns:
the decoded public key