Package net.handle.security.provider
Class GenericProvider
java.lang.Object
net.handle.security.HdlSecurityProvider
net.handle.security.provider.GenericProvider
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 -
Method Summary
Modifier and TypeMethodDescriptiongenerateDHKeyPair
(int keySize) byte[]
generateSecretKey
(int keyAlg) Generate and encode a secret key for use with the given algorithmgetCipher
(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
(DHPublicKey pub, DHPrivateKey priv) int
getIvSize
(int algorithm, int majorProtocolVersion, int minorProtocolVersion) Returns the length in bytes of the initialization vector used by the cipher generated by getCipher().byte[]
getKeyFromDH
(DHPublicKey pub, 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 arrayMethods inherited from class net.handle.security.HdlSecurityProvider
getCipher, getInstance
-
Constructor Details
-
GenericProvider
public GenericProvider()
-
-
Method Details
-
getCipher
public Cipher getCipher(int algorithm, byte[] secretKey, int direction, byte[] iv, int majorProtocolVersion, int minorProtocolVersion) throws Exception Construct 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:
getCipher
in classHdlSecurityProvider
- Throws:
Exception
-
getIvSize
public int getIvSize(int algorithm, int majorProtocolVersion, int minorProtocolVersion) Description copied from class:HdlSecurityProvider
Returns the length in bytes of the initialization vector used by the cipher generated by getCipher(). Returns 0 if no initialization vector.- Specified by:
getIvSize
in classHdlSecurityProvider
-
generateSecretKey
Generate and encode a secret key for use with the given algorithm- Specified by:
generateSecretKey
in classHdlSecurityProvider
- Throws:
Exception
-
getDESKeyFromDH
- Overrides:
getDESKeyFromDH
in classHdlSecurityProvider
- Throws:
Exception
-
getKeyFromDH
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- Overrides:
getKeyFromDH
in classHdlSecurityProvider
- Throws:
Exception
-
generateDHKeyPair
- Overrides:
generateDHKeyPair
in classHdlSecurityProvider
- Throws:
Exception
-
generateDHKeyPair
- Overrides:
generateDHKeyPair
in classHdlSecurityProvider
- Throws:
Exception
-