Class KeyFactorySpi

java.lang.Object
java.security.KeyFactorySpi
org.bouncycastle.jcajce.provider.asymmetric.util.BaseKeyFactorySpi
org.bouncycastle.jcajce.provider.asymmetric.compositesignatures.KeyFactorySpi
All Implemented Interfaces:
AsymmetricKeyInfoConverter

public class KeyFactorySpi extends BaseKeyFactorySpi implements AsymmetricKeyInfoConverter
KeyFactory for composite signatures. The supported combinations are listed in CompositeIndex.
  • Constructor Details

    • KeyFactorySpi

      public KeyFactorySpi()
    • KeyFactorySpi

      public KeyFactorySpi(JcaJceHelper helper)
  • Method Details

    • engineTranslateKey

      protected Key engineTranslateKey(Key key) throws InvalidKeyException
      Specified by:
      engineTranslateKey in class KeyFactorySpi
      Throws:
      InvalidKeyException
    • generatePrivate

      public PrivateKey generatePrivate(PrivateKeyInfo keyInfo) throws IOException
      Creates a CompositePrivateKey from its PrivateKeyInfo encoded form.

      For the current OIDs (draft-ietf-lamps-pq-composite-sigs, IANA arc 1.3.6.1.5.5.7.6.37-54) the privateKey body is the bare concatenation mldsaSeed || tradSK, with no inner ASN.1 structure. The superseded Entrust/OpenCA OIDs, whose body is a SEQUENCE of OneAsymmetricKey (the newer name for PrivateKeyInfo), are still decoded for compatibility.

      Specified by:
      generatePrivate in interface AsymmetricKeyInfoConverter
      Parameters:
      keyInfo - PrivateKeyInfo carrying the composite private key body.
      Returns:
      A CompositePrivateKey created from all components in the body.
      Throws:
      IOException
    • generatePublic

      public PublicKey generatePublic(SubjectPublicKeyInfo keyInfo) throws IOException
      Creates a CompositePublicKey from its SubjectPublicKeyInfo encoded form.

      For the current OIDs (draft-ietf-lamps-pq-composite-sigs, IANA arc 1.3.6.1.5.5.7.6.37-54) the subjectPublicKey BIT STRING holds the bare concatenation mldsaPK || tradPK, split at the fixed ML-DSA public key length. The superseded encodings - a SEQUENCE of SubjectPublicKeyInfo, or of BIT STRINGs - are still decoded for compatibility, which is why the sequence parse is attempted first and the fixed-length split is reached from its catch branch.

      Specified by:
      generatePublic in interface AsymmetricKeyInfoConverter
      Parameters:
      keyInfo - SubjectPublicKeyInfo carrying the composite public key body.
      Returns:
      A CompositePublicKey created from all components in the body.
      Throws:
      IOException