WEBsina Software

com.websina.util.security
Class KeyUtil

java.lang.Object
  extended bycom.websina.util.security.KeyUtil

public class KeyUtil
extends java.lang.Object

This is a utility class encode and decode keys.

Since:
1.0

Constructor Summary
KeyUtil()
           
 
Method Summary
static java.security.KeyPair getKeyPair()
          The method gets the key pair.
static java.security.PrivateKey getPrivate(byte[] encodedKey)
          This method gets the private key from the encoded byte.
static java.security.PublicKey getPublic(byte[] encodedKey)
          The method gets the public key from the encoded byte.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyUtil

public KeyUtil()
Method Detail

getPublic

public static java.security.PublicKey getPublic(byte[] encodedKey)
                                         throws java.security.spec.InvalidKeySpecException
The method gets the public key from the encoded byte. The bytes can be recovered from a Hex string saved in a file etc.

Parameters:
encodedKey - the encoded public key in bytes.
Throws:
java.security.spec.InvalidKeySpecException

getPrivate

public static java.security.PrivateKey getPrivate(byte[] encodedKey)
                                           throws java.security.spec.InvalidKeySpecException
This method gets the private key from the encoded byte. The bytes can be recovered from a Hex string saved in a file etc.

Parameters:
encodedKey - the encoded private key in bytes.
Throws:
java.security.spec.InvalidKeySpecException

getKeyPair

public static java.security.KeyPair getKeyPair()
The method gets the key pair.

Returns:
a pair of keys

WEBsina Software