Class McElieceCCA2KeyFactorySpi
- java.lang.Object
-
- java.security.KeyFactorySpi
-
- org.bouncycastle.pqc.jcajce.provider.mceliece.McElieceCCA2KeyFactorySpi
-
- All Implemented Interfaces:
AsymmetricKeyInfoConverter
public class McElieceCCA2KeyFactorySpi extends KeyFactorySpi implements AsymmetricKeyInfoConverter
This class is used to translate between McEliece CCA2 keys and key specifications.- See Also:
BCMcElieceCCA2PrivateKey
,BCMcElieceCCA2PublicKey
-
-
Constructor Summary
Constructors Constructor Description McElieceCCA2KeyFactorySpi()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected PrivateKey
engineGeneratePrivate(KeySpec keySpec)
Converts, if possible, a key specification into aBCMcElieceCCA2PrivateKey
.protected PublicKey
engineGeneratePublic(KeySpec keySpec)
Converts, if possible, a key specification into aBCMcElieceCCA2PublicKey
.protected KeySpec
engineGetKeySpec(Key key, Class tClass)
protected Key
engineTranslateKey(Key key)
PrivateKey
generatePrivate(PrivateKeyInfo pki)
PublicKey
generatePublic(SubjectPublicKeyInfo pki)
KeySpec
getKeySpec(Key key, Class keySpec)
Converts, if possible, a given key into a key specification.Key
translateKey(Key key)
Translates a key into a form known by the FlexiProvider.
-
-
-
Field Detail
-
OID
public static final String OID
The OID of the algorithm.- See Also:
- Constant Field Values
-
-
Method Detail
-
engineGeneratePublic
protected PublicKey engineGeneratePublic(KeySpec keySpec) throws InvalidKeySpecException
Converts, if possible, a key specification into aBCMcElieceCCA2PublicKey
. Currently, the following key specifications are supported:X509EncodedKeySpec
.- Specified by:
engineGeneratePublic
in classKeyFactorySpi
- Parameters:
keySpec
- the key specification- Returns:
- the McEliece CCA2 public key
- Throws:
InvalidKeySpecException
- if the key specification is not supported.
-
engineGeneratePrivate
protected PrivateKey engineGeneratePrivate(KeySpec keySpec) throws InvalidKeySpecException
Converts, if possible, a key specification into aBCMcElieceCCA2PrivateKey
. Currently, the following key specifications are supported:PKCS8EncodedKeySpec
.- Specified by:
engineGeneratePrivate
in classKeyFactorySpi
- Parameters:
keySpec
- the key specification- Returns:
- the McEliece CCA2 private key
- Throws:
InvalidKeySpecException
- if the KeySpec is not supported.
-
getKeySpec
public KeySpec getKeySpec(Key key, Class keySpec) throws InvalidKeySpecException
Converts, if possible, a given key into a key specification. Currently, the following key specifications are supported:- Parameters:
key
- the keykeySpec
- the key specification- Returns:
- the specification of the McEliece CCA2 key
- Throws:
InvalidKeySpecException
- if the key type or the key specification is not supported.- See Also:
BCMcElieceCCA2PrivateKey
,BCMcElieceCCA2PublicKey
-
translateKey
public Key translateKey(Key key) throws InvalidKeyException
Translates a key into a form known by the FlexiProvider. Currently, only the following "source" keys are supported:BCMcElieceCCA2PrivateKey
,BCMcElieceCCA2PublicKey
.- Parameters:
key
- the key- Returns:
- a key of a known key type
- Throws:
InvalidKeyException
- if the key type is not supported.
-
generatePublic
public PublicKey generatePublic(SubjectPublicKeyInfo pki) throws IOException
- Specified by:
generatePublic
in interfaceAsymmetricKeyInfoConverter
- Throws:
IOException
-
generatePrivate
public PrivateKey generatePrivate(PrivateKeyInfo pki) throws IOException
- Specified by:
generatePrivate
in interfaceAsymmetricKeyInfoConverter
- Throws:
IOException
-
engineGetKeySpec
protected KeySpec engineGetKeySpec(Key key, Class tClass) throws InvalidKeySpecException
- Specified by:
engineGetKeySpec
in classKeyFactorySpi
- Throws:
InvalidKeySpecException
-
engineTranslateKey
protected Key engineTranslateKey(Key key) throws InvalidKeyException
- Specified by:
engineTranslateKey
in classKeyFactorySpi
- Throws:
InvalidKeyException
-
-