Class KeyFactorySpi

    • Constructor Detail

      • KeyFactorySpi

        public KeyFactorySpi()
      • KeyFactorySpi

        public KeyFactorySpi​(JcaJceHelper helper)
    • Method Detail

      • engineTranslateKey

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

        public java.security.PrivateKey generatePrivate​(PrivateKeyInfo keyInfo)
                                                 throws java.io.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:
        java.io.IOException
      • generatePublic

        public java.security.PublicKey generatePublic​(SubjectPublicKeyInfo keyInfo)
                                               throws java.io.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:
        java.io.IOException