com.jp.protection.security
Class SunJCESecurityProvider

java.lang.Object
  extended by com.jp.protection.security.SunJCESecurityProvider
All Implemented Interfaces:
SecurityProvider

public class SunJCESecurityProvider
extends java.lang.Object
implements SecurityProvider


Field Summary
protected  java.lang.String fID
           
protected  int fKeySize
           
protected  java.lang.String fName
           
static java.lang.String ID
           
static java.lang.String NAME
           
static int[] SUPPORTED_KEY_LENGTHS
           
 
Constructor Summary
SunJCESecurityProvider()
           
SunJCESecurityProvider(int aKeySize)
           
 
Method Summary
protected  void checkKeySize(int aKeySize)
           
 byte[] decode(byte[] aData, java.security.PublicKey aPublicKey)
           
(package private) static byte[] doFinal(javax.crypto.Cipher aCipher, byte[] aData, boolean isEncode)
           
 byte[] encode(byte[] aData, java.security.PrivateKey aPrivateKey)
           
 java.security.KeyPair generateKeyPair()
           
protected  javax.crypto.Cipher getCipher()
           
 java.lang.String getID()
           
 int getKeyLength()
           
 java.lang.String getName()
           
 java.security.PrivateKey getPrivateKey(byte[] aKeyData)
           
 byte[] getPrivateKeyData(java.security.PrivateKey aPrivateKey)
           
 java.security.PublicKey getPublicKey(byte[] aKeyData)
           
 byte[] getPublicKeyData(java.security.PublicKey aPublicKey)
           
 int[] getSupportedKeyLengths()
           
protected static java.security.Key readKey(byte[] aKeyData, boolean isPublicKey)
           
static void registerSecurityProvider()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fKeySize

protected int fKeySize

NAME

public static final java.lang.String NAME
See Also:
Constant Field Values

ID

public static final java.lang.String ID
See Also:
Constant Field Values

fName

protected java.lang.String fName

fID

protected java.lang.String fID

SUPPORTED_KEY_LENGTHS

public static final int[] SUPPORTED_KEY_LENGTHS
Constructor Detail

SunJCESecurityProvider

public SunJCESecurityProvider(int aKeySize)

SunJCESecurityProvider

public SunJCESecurityProvider()
Method Detail

registerSecurityProvider

public static void registerSecurityProvider()

doFinal

static byte[] doFinal(javax.crypto.Cipher aCipher,
                      byte[] aData,
                      boolean isEncode)
               throws javax.crypto.BadPaddingException,
                      javax.crypto.IllegalBlockSizeException,
                      java.lang.IllegalStateException,
                      java.io.IOException
Throws:
javax.crypto.BadPaddingException
javax.crypto.IllegalBlockSizeException
java.lang.IllegalStateException
java.io.IOException

checkKeySize

protected void checkKeySize(int aKeySize)

decode

public byte[] decode(byte[] aData,
                     java.security.PublicKey aPublicKey)
Specified by:
decode in interface SecurityProvider

encode

public byte[] encode(byte[] aData,
                     java.security.PrivateKey aPrivateKey)
Specified by:
encode in interface SecurityProvider

getCipher

protected javax.crypto.Cipher getCipher()
                                 throws javax.crypto.NoSuchPaddingException,
                                        java.security.NoSuchProviderException,
                                        java.security.NoSuchAlgorithmException
Throws:
javax.crypto.NoSuchPaddingException
java.security.NoSuchProviderException
java.security.NoSuchAlgorithmException

generateKeyPair

public java.security.KeyPair generateKeyPair()
Specified by:
generateKeyPair in interface SecurityProvider

getID

public java.lang.String getID()
Specified by:
getID in interface SecurityProvider

getName

public java.lang.String getName()
Specified by:
getName in interface SecurityProvider

readKey

protected static java.security.Key readKey(byte[] aKeyData,
                                           boolean isPublicKey)

getPrivateKey

public java.security.PrivateKey getPrivateKey(byte[] aKeyData)
Specified by:
getPrivateKey in interface SecurityProvider

getPrivateKeyData

public byte[] getPrivateKeyData(java.security.PrivateKey aPrivateKey)
Specified by:
getPrivateKeyData in interface SecurityProvider

getPublicKey

public java.security.PublicKey getPublicKey(byte[] aKeyData)
Specified by:
getPublicKey in interface SecurityProvider

getPublicKeyData

public byte[] getPublicKeyData(java.security.PublicKey aPublicKey)
Specified by:
getPublicKeyData in interface SecurityProvider

getSupportedKeyLengths

public int[] getSupportedKeyLengths()
Specified by:
getSupportedKeyLengths in interface SecurityProvider

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getKeyLength

public int getKeyLength()
Specified by:
getKeyLength in interface SecurityProvider