de.flexiprovider.pqc.ecc.mceliece
Class McElieceKeyFactory

java.lang.Object
  |
  +--java.security.KeyFactorySpi
        |
        +--de.flexiprovider.api.keys.KeyFactory
              |
              +--de.flexiprovider.pqc.ecc.mceliece.McElieceKeyFactory

public class McElieceKeyFactory
extends KeyFactory

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

Author:
Elena Klintsevich, Martin Döring
See Also:
McEliecePrivateKey, McEliecePrivateKeySpec, McEliecePublicKey, McEliecePublicKeySpec

Field Summary
static java.lang.String OID
          The OID of the algorithm.
 
Constructor Summary
McElieceKeyFactory()
           
 
Method Summary
 PrivateKey generatePrivate(KeySpec keySpec)
          Converts, if possible, a key specification into a McEliecePrivateKey.
 PublicKey generatePublic(KeySpec keySpec)
          Converts, if possible, a key specification into a McEliecePublicKey.
 KeySpec getKeySpec(Key key, java.lang.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.
 
Methods inherited from class de.flexiprovider.api.keys.KeyFactory
engineGeneratePrivate, engineGeneratePublic, engineGetKeySpec, engineTranslateKey
 
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

McElieceKeyFactory

public McElieceKeyFactory()
Method Detail

generatePublic

public PublicKey generatePublic(KeySpec keySpec)
                         throws InvalidKeySpecException
Converts, if possible, a key specification into a McEliecePublicKey. Currently, the following key specifications are supported: McEliecePublicKeySpec, X509EncodedKeySpec.
Overrides:
generatePublic in class KeyFactory
Parameters:
keySpec - the key specification
Returns:
the McEliece public key
Throws:
InvalidKeySpecException - if the key specification is not supported.

generatePrivate

public PrivateKey generatePrivate(KeySpec keySpec)
                           throws InvalidKeySpecException
Converts, if possible, a key specification into a McEliecePrivateKey. Currently, the following key specifications are supported: McEliecePrivateKeySpec, PKCS8EncodedKeySpec.
Overrides:
generatePrivate in class KeyFactory
Parameters:
keySpec - the key specification
Returns:
the McEliece private key
Throws:
InvalidKeySpecException - if the KeySpec is not supported.

getKeySpec

public KeySpec getKeySpec(Key key,
                          java.lang.Class keySpec)
                   throws InvalidKeySpecException
Converts, if possible, a given key into a key specification. Currently, the following key specifications are supported:
Overrides:
getKeySpec in class KeyFactory
Parameters:
key - the key
keySpec - the key specification
Returns:
the specification of the McEliece key
Throws:
InvalidKeySpecException - if the key type or the key specification is not supported.
See Also:
McEliecePrivateKey, McEliecePrivateKeySpec, McEliecePublicKey, McEliecePublicKeySpec

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: McEliecePrivateKey, McEliecePublicKey.
Overrides:
translateKey in class KeyFactory
Parameters:
key - the key
Returns:
a key of a known key type
Throws:
InvalidKeyException - if the key type is not supported.