Class AbstractTlsSecret

java.lang.Object
org.bouncycastle.tls.crypto.impl.AbstractTlsSecret
All Implemented Interfaces:
TlsSecret
Direct Known Subclasses:
BcTlsSecret, JceTlsSecret

public abstract class AbstractTlsSecret extends Object implements TlsSecret
Base class for a TlsSecret implementation which captures common code and fields.
  • Field Details

    • data

      protected byte[] data
  • Constructor Details

    • AbstractTlsSecret

      protected AbstractTlsSecret(byte[] data)
      Base constructor.
      Parameters:
      data - the byte[] making up the secret value.
  • Method Details

    • checkAlive

      protected void checkAlive()
    • getCrypto

      protected abstract AbstractTlsCrypto getCrypto()
    • destroy

      public void destroy()
      Description copied from interface: TlsSecret
      Destroy the internal state of the secret. After this call, any attempt to use the TlsSecret will result in an IllegalStateException being thrown.
      Specified by:
      destroy in interface TlsSecret
    • encrypt

      public byte[] encrypt(TlsCertificate certificate) throws IOException
      Description copied from interface: TlsSecret
      Return the an encrypted copy of the data this secret is based on.
      Specified by:
      encrypt in interface TlsSecret
      Parameters:
      certificate - the certificate containing the public key to use for protecting the internal data.
      Returns:
      an encrypted copy of secret's internal data.
      Throws:
      IOException
    • extract

      public byte[] extract()
      Description copied from interface: TlsSecret
      Return the internal data from this secret. The TlsSecret does not keep a copy of the data. After this call, any attempt to use the TlsSecret will result in an IllegalStateException being thrown.
      Specified by:
      extract in interface TlsSecret
      Returns:
      the secret's internal data.
    • isAlive

      public boolean isAlive()
      Specified by:
      isAlive in interface TlsSecret