Class HdlSecurityProvider

java.lang.Object
net.handle.security.HdlSecurityProvider
Direct Known Subclasses:
GenericProvider

public abstract class HdlSecurityProvider extends Object
  • Field Details

  • Constructor Details

    • HdlSecurityProvider

      public HdlSecurityProvider()
  • Method Details

    • getInstance

      public static final HdlSecurityProvider getInstance()
    • getCipher

      @Deprecated public Cipher getCipher(int algorithm, byte[] secretKey, int direction) throws Exception
      Deprecated.
      Use getCipher(int,byte[],int,byte[],int,int) in order to specify protocol version.
      Throws:
      Exception
    • getCipher

      public abstract 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. iv is the initialization vector, needed for decrypting with CBC.
      Throws:
      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 Exception
      Generate and encode a secret key for use with the given algorithm
      Throws:
      Exception
    • generateDHKeyPair

      public KeyPair generateDHKeyPair(int keySize) throws Exception
      Throws:
      Exception
    • generateDHKeyPair

      public KeyPair generateDHKeyPair(BigInteger p, BigInteger g) throws Exception
      Throws:
      Exception
    • getDESKeyFromDH

      public byte[] getDESKeyFromDH(DHPublicKey pub, DHPrivateKey priv) throws Exception
      Throws:
      Exception
    • getKeyFromDH

      public byte[] getKeyFromDH(DHPublicKey pub, DHPrivateKey priv, int algorithm) throws Exception
      Using 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:
      Exception