Class McElieceCCA2KeyFactorySpi
- java.lang.Object
-
- java.security.KeyFactorySpi
-
- org.bouncycastle.pqc.jcajce.provider.mceliece.McElieceCCA2KeyFactorySpi
-
- All Implemented Interfaces:
AsymmetricKeyInfoConverter
public class McElieceCCA2KeyFactorySpi extends java.security.KeyFactorySpi implements AsymmetricKeyInfoConverter
This class is used to translate between McEliece CCA2 keys and key specifications.- See Also:
BCMcElieceCCA2PrivateKey,BCMcElieceCCA2PublicKey
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringOIDThe OID of the algorithm.
-
Constructor Summary
Constructors Constructor Description McElieceCCA2KeyFactorySpi()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.security.PrivateKeyengineGeneratePrivate(java.security.spec.KeySpec keySpec)Converts, if possible, a key specification into aBCMcElieceCCA2PrivateKey.protected java.security.PublicKeyengineGeneratePublic(java.security.spec.KeySpec keySpec)Converts, if possible, a key specification into aBCMcElieceCCA2PublicKey.protected java.security.spec.KeySpecengineGetKeySpec(java.security.Key key, java.lang.Class tClass)protected java.security.KeyengineTranslateKey(java.security.Key key)java.security.PrivateKeygeneratePrivate(PrivateKeyInfo pki)java.security.PublicKeygeneratePublic(SubjectPublicKeyInfo pki)java.security.spec.KeySpecgetKeySpec(java.security.Key key, java.lang.Class keySpec)Converts, if possible, a given key into a key specification.java.security.KeytranslateKey(java.security.Key key)Translates a key into a form known by the FlexiProvider.
-
-
-
Field Detail
-
OID
public static final java.lang.String OID
The OID of the algorithm.- See Also:
- Constant Field Values
-
-
Method Detail
-
engineGeneratePublic
protected java.security.PublicKey engineGeneratePublic(java.security.spec.KeySpec keySpec) throws java.security.spec.InvalidKeySpecExceptionConverts, if possible, a key specification into aBCMcElieceCCA2PublicKey. Currently, the following key specifications are supported:X509EncodedKeySpec.- Specified by:
engineGeneratePublicin classjava.security.KeyFactorySpi- Parameters:
keySpec- the key specification- Returns:
- the McEliece CCA2 public key
- Throws:
java.security.spec.InvalidKeySpecException- if the key specification is not supported.
-
engineGeneratePrivate
protected java.security.PrivateKey engineGeneratePrivate(java.security.spec.KeySpec keySpec) throws java.security.spec.InvalidKeySpecExceptionConverts, if possible, a key specification into aBCMcElieceCCA2PrivateKey. Currently, the following key specifications are supported:PKCS8EncodedKeySpec.- Specified by:
engineGeneratePrivatein classjava.security.KeyFactorySpi- Parameters:
keySpec- the key specification- Returns:
- the McEliece CCA2 private key
- Throws:
java.security.spec.InvalidKeySpecException- if the KeySpec is not supported.
-
getKeySpec
public java.security.spec.KeySpec getKeySpec(java.security.Key key, java.lang.Class keySpec) throws java.security.spec.InvalidKeySpecExceptionConverts, 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:
java.security.spec.InvalidKeySpecException- if the key type or the key specification is not supported.- See Also:
BCMcElieceCCA2PrivateKey,BCMcElieceCCA2PublicKey
-
translateKey
public java.security.Key translateKey(java.security.Key key) throws java.security.InvalidKeyExceptionTranslates 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:
java.security.InvalidKeyException- if the key type is not supported.
-
generatePublic
public java.security.PublicKey generatePublic(SubjectPublicKeyInfo pki) throws java.io.IOException
- Specified by:
generatePublicin interfaceAsymmetricKeyInfoConverter- Throws:
java.io.IOException
-
generatePrivate
public java.security.PrivateKey generatePrivate(PrivateKeyInfo pki) throws java.io.IOException
- Specified by:
generatePrivatein interfaceAsymmetricKeyInfoConverter- Throws:
java.io.IOException
-
engineGetKeySpec
protected java.security.spec.KeySpec engineGetKeySpec(java.security.Key key, java.lang.Class tClass) throws java.security.spec.InvalidKeySpecException- Specified by:
engineGetKeySpecin classjava.security.KeyFactorySpi- Throws:
java.security.spec.InvalidKeySpecException
-
engineTranslateKey
protected java.security.Key engineTranslateKey(java.security.Key key) throws java.security.InvalidKeyException- Specified by:
engineTranslateKeyin classjava.security.KeyFactorySpi- Throws:
java.security.InvalidKeyException
-
-