Package net.handle.security.provider
Class GenericProvider
- java.lang.Object
 - 
- net.handle.security.HdlSecurityProvider
 - 
- net.handle.security.provider.GenericProvider
 
 
 
- 
public final class GenericProvider extends HdlSecurityProvider
An implementation of the net.handle.HDLSecurityProvider interface that accesses the generic java security/crypto interfaces. 
- 
- 
Field Summary
- 
Fields inherited from class net.handle.security.HdlSecurityProvider
ENCRYPT_ALG_AES, ENCRYPT_ALG_DES, ENCRYPT_ALG_DESEDE 
 - 
 
- 
Constructor Summary
Constructors Constructor Description GenericProvider() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.security.KeyPairgenerateDHKeyPair(int keySize)java.security.KeyPairgenerateDHKeyPair(java.math.BigInteger p, java.math.BigInteger g)byte[]generateSecretKey(int keyAlg)Generate and encode a secret key for use with the given algorithmjavax.crypto.CiphergetCipher(int algorithm, byte[] secretKey, int direction, byte[] iv, int majorProtocolVersion, int minorProtocolVersion)Construct and return a Cipher object, initialized to either decrypt or encrypt using the given algorithm and secret key.byte[]getDESKeyFromDH(javax.crypto.interfaces.DHPublicKey pub, javax.crypto.interfaces.DHPrivateKey priv)intgetIvSize(int algorithm, int majorProtocolVersion, int minorProtocolVersion)Returns the length in bytes of the initialization vector used by the cipher generated by getCipher().byte[]getKeyFromDH(javax.crypto.interfaces.DHPublicKey pub, javax.crypto.interfaces.DHPrivateKey priv, int algorithm)Using the given diffie-hellman key pair, generate the secret key with the algorithm ID (ENCRYPT_ALG_DES, ENCRYPT_ALG_AES or ENCRYPT_ALG_DESEDE) in the first four bytes of the array- 
Methods inherited from class net.handle.security.HdlSecurityProvider
getCipher, getInstance 
 - 
 
 - 
 
- 
- 
Method Detail
- 
getCipher
public javax.crypto.Cipher getCipher(int algorithm, byte[] secretKey, int direction, byte[] iv, int majorProtocolVersion, int minorProtocolVersion) throws java.lang.ExceptionConstruct and return a Cipher object, initialized to either decrypt or encrypt using the given algorithm and secret key. The direction parameter must be either Cipher.ENCRYPT_MODE or Cipher.DECRYPT_MODE. The algorithm parameter should be one of the HdlSecurityProvider.ENCRYPT_ALG_* constants.- Specified by:
 getCipherin classHdlSecurityProvider- Throws:
 java.lang.Exception
 
- 
getIvSize
public int getIvSize(int algorithm, int majorProtocolVersion, int minorProtocolVersion)Description copied from class:HdlSecurityProviderReturns the length in bytes of the initialization vector used by the cipher generated by getCipher(). Returns 0 if no initialization vector.- Specified by:
 getIvSizein classHdlSecurityProvider
 
- 
generateSecretKey
public byte[] generateSecretKey(int keyAlg) throws java.lang.ExceptionGenerate and encode a secret key for use with the given algorithm- Specified by:
 generateSecretKeyin classHdlSecurityProvider- Throws:
 java.lang.Exception
 
- 
getDESKeyFromDH
public byte[] getDESKeyFromDH(javax.crypto.interfaces.DHPublicKey pub, javax.crypto.interfaces.DHPrivateKey priv) throws java.lang.Exception- Overrides:
 getDESKeyFromDHin classHdlSecurityProvider- Throws:
 java.lang.Exception
 
- 
getKeyFromDH
public byte[] getKeyFromDH(javax.crypto.interfaces.DHPublicKey pub, javax.crypto.interfaces.DHPrivateKey priv, int algorithm) throws java.lang.ExceptionUsing the given diffie-hellman key pair, generate the secret key with the algorithm ID (ENCRYPT_ALG_DES, ENCRYPT_ALG_AES or ENCRYPT_ALG_DESEDE) in the first four bytes of the array- Overrides:
 getKeyFromDHin classHdlSecurityProvider- Throws:
 java.lang.Exception
 
- 
generateDHKeyPair
public java.security.KeyPair generateDHKeyPair(int keySize) throws java.lang.Exception- Overrides:
 generateDHKeyPairin classHdlSecurityProvider- Throws:
 java.lang.Exception
 
- 
generateDHKeyPair
public java.security.KeyPair generateDHKeyPair(java.math.BigInteger p, java.math.BigInteger g) throws java.lang.Exception- Overrides:
 generateDHKeyPairin classHdlSecurityProvider- Throws:
 java.lang.Exception
 
 - 
 
 -