Class AbstractWrappedKey<T extends org.bouncycastle.crypto.params.AsymmetricKeyParameter>

java.lang.Object
org.cryptacular.adapter.AbstractWrappedKey<T>
Type Parameters:
T - Asymmetric key parameters type wrapped by this class.
All Implemented Interfaces:
Serializable, Key
Direct Known Subclasses:
AbstractWrappedDSAKey, AbstractWrappedECKey, AbstractWrappedRSAKey

public abstract class AbstractWrappedKey<T extends org.bouncycastle.crypto.params.AsymmetricKeyParameter> extends Object implements Key
JCE/JDK key base class that wraps a BC native private key.
Author:
Middleware Services
See Also:
  • Field Details

    • PKCS8_FORMAT

      public static final String PKCS8_FORMAT
      PKCS#8 format identifier used with private keys.
      See Also:
    • X509_FORMAT

      public static final String X509_FORMAT
      X.509 format identifier used with private keys.
      See Also:
    • delegate

      protected final T extends org.bouncycastle.crypto.params.AsymmetricKeyParameter delegate
      Wrapped key.
  • Constructor Details

    • AbstractWrappedKey

      public AbstractWrappedKey(T wrappedKey)
      Creates a new instance that wraps the given BC key.
      Parameters:
      wrappedKey - BC key to wrap.
  • Method Details

    • getFormat

      public String getFormat()
      Specified by:
      getFormat in interface Key
      Returns:
      "PKCS#8" in the case of a private key, otherwise X509_FORMAT.
    • getEncoded

      public byte[] getEncoded()
      Specified by:
      getEncoded in interface Key
      Returns:
      Encoded PrivateKeyInfo structure in the case of a private key, otherwise an encoded SubjectPublicKeyInfo structure.