Package net.handle.security
Class HdlSecurityProvider
- java.lang.Object
 - 
- net.handle.security.HdlSecurityProvider
 
 
- 
- Direct Known Subclasses:
 GenericProvider
public abstract class HdlSecurityProvider extends java.lang.Object 
- 
- 
Field Summary
Fields Modifier and Type Field Description static intENCRYPT_ALG_AESstatic intENCRYPT_ALG_DESstatic intENCRYPT_ALG_DESEDE 
- 
Constructor Summary
Constructors Constructor Description HdlSecurityProvider() 
- 
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.security.KeyPairgenerateDHKeyPair(int keySize)java.security.KeyPairgenerateDHKeyPair(java.math.BigInteger p, java.math.BigInteger g)abstract byte[]generateSecretKey(int keyAlg)Generate and encode a secret key for use with the given algorithmjavax.crypto.CiphergetCipher(int algorithm, byte[] secretKey, int direction)Deprecated.UsegetCipher(int,byte[],int,byte[],int,int)in order to specify protocol version.abstract javax.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)static HdlSecurityProvidergetInstance()abstract 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 a secret key with the given algorithm. 
 - 
 
- 
- 
Field Detail
- 
ENCRYPT_ALG_DES
public static final int ENCRYPT_ALG_DES
- See Also:
 - Constant Field Values
 
 
- 
ENCRYPT_ALG_DESEDE
public static final int ENCRYPT_ALG_DESEDE
- See Also:
 - Constant Field Values
 
 
- 
ENCRYPT_ALG_AES
public static final int ENCRYPT_ALG_AES
- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Method Detail
- 
getInstance
public static final HdlSecurityProvider getInstance()
 
- 
getCipher
@Deprecated public javax.crypto.Cipher getCipher(int algorithm, byte[] secretKey, int direction) throws java.lang.ExceptionDeprecated.UsegetCipher(int,byte[],int,byte[],int,int)in order to specify protocol version.- Throws:
 java.lang.Exception
 
- 
getCipher
public abstract 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. iv is the initialization vector, needed for decrypting with CBC.- Throws:
 java.lang.Exception
 
- 
getIvSize
public abstract int getIvSize(int algorithm, int majorProtocolVersion, int minorProtocolVersion)Returns the length in bytes of the initialization vector used by the cipher generated by getCipher(). Returns 0 if no initialization vector. 
- 
generateSecretKey
public abstract byte[] generateSecretKey(int keyAlg) throws java.lang.ExceptionGenerate and encode a secret key for use with the given algorithm- Throws:
 java.lang.Exception
 
- 
generateDHKeyPair
public java.security.KeyPair generateDHKeyPair(int keySize) throws java.lang.Exception- Throws:
 java.lang.Exception
 
- 
generateDHKeyPair
public java.security.KeyPair generateDHKeyPair(java.math.BigInteger p, java.math.BigInteger g) throws java.lang.Exception- Throws:
 java.lang.Exception
 
- 
getDESKeyFromDH
public byte[] getDESKeyFromDH(javax.crypto.interfaces.DHPublicKey pub, javax.crypto.interfaces.DHPrivateKey priv) throws java.lang.Exception- 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 a secret key with the given algorithm. The first four bytes of the secret key will identify the algorithm for the secret key (DES, AES, DESede)- Throws:
 java.lang.Exception
 
 - 
 
 -