public class MLDSAKeyFactory extends KeyFactorySpi
KeyFactorySpi
Constructor and Description |
---|
MLDSAKeyFactory() |
Modifier and Type | Method and Description |
---|---|
protected PrivateKey |
engineGeneratePrivate(KeySpec keySpec)
Generates a private key from the given key spec.
|
protected PublicKey |
engineGeneratePublic(KeySpec keySpec)
Generates a public key from the given key spec.
|
protected <T extends KeySpec> |
engineGetKeySpec(Key key,
Class<T> keySpec)
Implementation of the engine method.
|
protected Key |
engineTranslateKey(Key key)
Translates the given key object of some unknown or untrusted provider into
a key object supported by this ML-DSA key factory.
|
static MLDSAPrivateKey |
translatePrivateKey(PrivateKey key)
Translation routine for ML-DSA private keys.
|
static MLDSAPublicKey |
translatePublicKey(PublicKey key)
Translation routine for ML-DSA public keys.
|
public static MLDSAPublicKey translatePublicKey(PublicKey key) throws InvalidKeyException
key
- the private key to be translatedInvalidKeyException
- if the key could not be translatedpublic static MLDSAPrivateKey translatePrivateKey(PrivateKey key) throws InvalidKeyException
key
- the private key to be translatedInvalidKeyException
- if the key could not be translatedprotected PublicKey engineGeneratePublic(KeySpec keySpec) throws InvalidKeySpecException
engineGeneratePublic
in class KeyFactorySpi
keySpec
- the key material; it may either be MLDSAPublicKeySpec
or
X509EncodedKeySpec
InvalidKeySpecException
- if the key spec is not supported or erroneousprotected PrivateKey engineGeneratePrivate(KeySpec keySpec) throws InvalidKeySpecException
engineGeneratePrivate
in class KeyFactorySpi
keySpec
- the key material; it may either be MLDSAPrivateKeySpec
or
PKCS8EncodedKeySpec
InvalidKeySpecException
- if the key spec is not supported or erroneousprotected <T extends KeySpec> T engineGetKeySpec(Key key, Class<T> keySpec) throws InvalidKeySpecException
engineGetKeySpec
in class KeyFactorySpi
key
- the key to be converted (either MLDSAPrivateKey
or
MLDSAPublicKey
)keySpec
- the key specification type. If the given key is of type
MLDSAPrivateKey
the keySpec may be MLDSAPrivateKeySpec
or
PKCS8EncodedKeySpec
.
Otherwise (key is of type
MLDSAPublicKey
) the keySpec must be
MLDSAPublicKeySpec
or X509EncodedKeySpec
InvalidKeySpecException
- if the key cannot be transformed into the provided keySpec.protected Key engineTranslateKey(Key key) throws InvalidKeyException
MLDSAPrivateKey
or MLDSAPublicKey
.engineTranslateKey
in class KeyFactorySpi
key
- the key to be translatedInvalidKeyException
- if the given key cannot be translatedCopyright © 2020–2024 Stiftung SIC. All rights reserved.