Bouncy Castle Cryptography Library 1.79

org.bouncycastle.pqc.jcajce.provider.mceliece
Class McElieceKeyFactorySpi

java.lang.Object
  |
  +--java.security.KeyFactorySpi
        |
        +--org.bouncycastle.pqc.jcajce.provider.mceliece.McElieceKeyFactorySpi
All Implemented Interfaces:
AsymmetricKeyInfoConverter

public class McElieceKeyFactorySpi
extends java.security.KeyFactorySpi
implements AsymmetricKeyInfoConverter

This class is used to translate between McEliece keys and key specifications.

See Also:
BCMcEliecePrivateKey, BCMcEliecePublicKey

Field Summary
static java.lang.String OID
          The OID of the algorithm.
 
Constructor Summary
McElieceKeyFactorySpi()
           
 
Method Summary
protected  java.security.PrivateKey engineGeneratePrivate(java.security.spec.KeySpec keySpec)
          Converts, if possible, a key specification into a BCMcEliecePrivateKey.
protected  java.security.PublicKey engineGeneratePublic(java.security.spec.KeySpec keySpec)
          Converts, if possible, a key specification into a BCMcEliecePublicKey.
protected  java.security.spec.KeySpec engineGetKeySpec(java.security.Key key, java.lang.Class tClass)
           
protected  java.security.Key engineTranslateKey(java.security.Key key)
           
 java.security.PrivateKey generatePrivate(PrivateKeyInfo pki)
           
 java.security.PublicKey generatePublic(SubjectPublicKeyInfo pki)
           
 java.security.spec.KeySpec getKeySpec(java.security.Key key, java.lang.Class keySpec)
          Converts, if possible, a given key into a key specification.
 java.security.Key translateKey(java.security.Key key)
          Translates a key into a form known by the FlexiProvider.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OID

public static final java.lang.String OID
The OID of the algorithm.
Constructor Detail

McElieceKeyFactorySpi

public McElieceKeyFactorySpi()
Method Detail

engineGeneratePublic

protected java.security.PublicKey engineGeneratePublic(java.security.spec.KeySpec keySpec)
                                                throws java.security.spec.InvalidKeySpecException
Converts, if possible, a key specification into a BCMcEliecePublicKey. X509EncodedKeySpec.
Overrides:
engineGeneratePublic in class java.security.KeyFactorySpi
Parameters:
keySpec - the key specification
Returns:
the McEliece 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.InvalidKeySpecException
Converts, if possible, a key specification into a BCMcEliecePrivateKey.
Overrides:
engineGeneratePrivate in class java.security.KeyFactorySpi
Parameters:
keySpec - the key specification
Returns:
the McEliece 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.InvalidKeySpecException
Converts, if possible, a given key into a key specification. Currently, the following key specifications are supported:
Parameters:
key - the key
keySpec - the key specification
Returns:
the specification of the McEliece key
Throws:
java.security.spec.InvalidKeySpecException - if the key type or the key specification is not supported.
See Also:
BCMcEliecePrivateKey, BCMcEliecePublicKey

translateKey

public java.security.Key translateKey(java.security.Key key)
                               throws java.security.InvalidKeyException
Translates a key into a form known by the FlexiProvider. Currently, only the following "source" keys are supported: BCMcEliecePrivateKey, BCMcEliecePublicKey.
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:
generatePublic in interface AsymmetricKeyInfoConverter

generatePrivate

public java.security.PrivateKey generatePrivate(PrivateKeyInfo pki)
                                         throws java.io.IOException
Specified by:
generatePrivate in interface AsymmetricKeyInfoConverter

engineGetKeySpec

protected java.security.spec.KeySpec engineGetKeySpec(java.security.Key key,
                                                      java.lang.Class tClass)
                                               throws java.security.spec.InvalidKeySpecException
Overrides:
engineGetKeySpec in class java.security.KeyFactorySpi

engineTranslateKey

protected java.security.Key engineTranslateKey(java.security.Key key)
                                        throws java.security.InvalidKeyException
Overrides:
engineTranslateKey in class java.security.KeyFactorySpi

Bouncy Castle Cryptography Library 1.79