Class KeyFactorySpi
- java.lang.Object
-
- java.security.KeyFactorySpi
-
- org.bouncycastle.jcajce.provider.asymmetric.util.BaseKeyFactorySpi
-
- org.bouncycastle.jcajce.provider.asymmetric.compositekem.KeyFactorySpi
-
- All Implemented Interfaces:
AsymmetricKeyInfoConverter
public class KeyFactorySpi extends BaseKeyFactorySpi implements AsymmetricKeyInfoConverter
KeyFactory for Composite ML-KEM keys as defined in Composite ML-KEM for use in X.509 Public Key Infrastructure. The supported parameter sets are registered inCompositeIndex.
-
-
Constructor Summary
Constructors Constructor Description KeyFactorySpi()KeyFactorySpi(JcaJceHelper helper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.security.KeyengineTranslateKey(java.security.Key key)java.security.PrivateKeygeneratePrivate(PrivateKeyInfo keyInfo)Creates aCompositePrivateKeyfrom its PrivateKeyInfo encoded form.java.security.PublicKeygeneratePublic(SubjectPublicKeyInfo keyInfo)Creates aCompositePublicKeyfrom its SubjectPublicKeyInfo encoded form.-
Methods inherited from class org.bouncycastle.jcajce.provider.asymmetric.util.BaseKeyFactorySpi
engineGeneratePrivate, engineGeneratePublic, engineGetKeySpec
-
-
-
-
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:
engineTranslateKeyin classjava.security.KeyFactorySpi- Throws:
java.security.InvalidKeyException
-
generatePrivate
public java.security.PrivateKey generatePrivate(PrivateKeyInfo keyInfo) throws java.io.IOException
Creates aCompositePrivateKeyfrom its PrivateKeyInfo encoded form. Per draft-ietf-lamps-pq-composite-kem the private key body is the 64-byte ML-KEM seed concatenated with the traditional private key encoding; the two components are split and decoded with their respective component key factories.- Specified by:
generatePrivatein interfaceAsymmetricKeyInfoConverter- Parameters:
keyInfo- PrivateKeyInfo whose key body is the concatenation of the two component keys.- Returns:
- A CompositePrivateKey holding both component private keys.
- Throws:
java.io.IOException- on a malformed encoding.
-
generatePublic
public java.security.PublicKey generatePublic(SubjectPublicKeyInfo keyInfo) throws java.io.IOException
Creates aCompositePublicKeyfrom its SubjectPublicKeyInfo encoded form. Per draft-ietf-lamps-pq-composite-kem the public key is the concatenation of the two raw component public keys; it is split at the fixed ML-KEM public key size and each component is decoded with its key factory.- Specified by:
generatePublicin interfaceAsymmetricKeyInfoConverter- Parameters:
keyInfo- SubjectPublicKeyInfo whose key body is the concatenation of the two component public keys.- Returns:
- A CompositePublicKey holding both component public keys.
- Throws:
java.io.IOException- on a malformed encoding.
-
-