Class AbstractTlsCrypto

  • All Implemented Interfaces:
    TlsCrypto
    Direct Known Subclasses:
    BcTlsCrypto, JcaTlsCrypto

    public abstract class AbstractTlsCrypto
    extends java.lang.Object
    implements TlsCrypto
    Base class for a TlsCrypto implementation that provides some needed methods from elsewhere in the impl package.
    • Constructor Detail

      • AbstractTlsCrypto

        public AbstractTlsCrypto()
    • Method Detail

      • adoptSecret

        public TlsSecret adoptSecret​(TlsSecret secret)
        Adopt the passed in secret, creating a new copy of it..
        Specified by:
        adoptSecret in interface TlsCrypto
        Parameters:
        secret - the secret to make a copy of.
        Returns:
        a TlsSecret based the original secret.
      • createCipher

        protected abstract TlsCipher createCipher​(TlsCryptoParameters cryptoParams,
                                                  int encryptionAlgorithm,
                                                  int macAlgorithm)
                                           throws java.io.IOException
        Create a cipher for the specified encryption and MAC algorithms.

        See enumeration classes EncryptionAlgorithm, MACAlgorithm for appropriate argument values.

        Parameters:
        cryptoParams - context specific parameters.
        encryptionAlgorithm - the encryption algorithm to be employed by the cipher.
        macAlgorithm - the MAC algorithm to be employed by the cipher.
        Returns:
        a TlsCipher implementing the encryption and MAC algorithm.
        Throws:
        java.io.IOException
      • createEncryptor

        protected abstract TlsEncryptor createEncryptor​(TlsCertificate certificate)
                                                 throws java.io.IOException
        Return an encryptor based on the public key in certificate.
        Parameters:
        certificate - the certificate carrying the public key.
        Returns:
        a TlsEncryptor based on the certificate's public key.
        Throws:
        java.io.IOException