public class EdKeyFactory extends KeyFactorySpi
EdPublicKey <--> EdPublicKeySpec, X509EncodedKeySpec EdPrivateKey <--> EdPrivateKeySpec, PKCS8EncodedKeySpec
EdKey
,
EdPrivateKey
,
EdPrivateKeySpec
,
EdPublicKey
,
EdPublicKeySpec
Constructor and Description |
---|
EdKeyFactory()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected PrivateKey |
engineGeneratePrivate(KeySpec keySpec)
Generates a private key from the given key spec.
|
protected EdPublicKey |
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 EC key factory.
|
static EdKey |
translateKey(Key key)
Translates a key to an
EdKey . |
protected static EdPublicKey |
translatePublicKey(PublicKey key)
Translation routine for public keys.
|
protected EdPublicKey engineGeneratePublic(KeySpec keySpec) throws InvalidKeySpecException
engineGeneratePublic
in class KeyFactorySpi
keySpec
- the key spec may be a X509EncodedKeySpec
or a
EdPublicKeySpec
.InvalidKeySpecException
- if the key spec can is not supported or erroneous.protected PrivateKey engineGeneratePrivate(KeySpec keySpec) throws InvalidKeySpecException
engineGeneratePrivate
in class KeyFactorySpi
keySpec
- the key material; it may either be EdPrivateKeySpec
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 EdPublicKey
or
EdPrivateKey
)keySpec
- the key specification type. If the given key is of type
EdPublicKey
the keySpec may be EdPublicKeySpec
or
X509EncodedKeySpec
. Otherwise (key is of type
EdPrivateKey
) the keySpec may be EdPrivateKeySpec
or PKCS8EncodedKeySpec
InvalidKeySpecException
- if the key cannot be transformed into the provided keySpec.protected Key engineTranslateKey(Key key) throws InvalidKeyException
EdPublicKey
or EdPrivateKey
.engineTranslateKey
in class KeyFactorySpi
key
- the key to be translatedInvalidKeyException
- if the given key cannot be translatedprotected static EdPublicKey translatePublicKey(PublicKey key) throws InvalidKeyException
key
- the public key to be translatednull
if it could not be convertedInvalidKeyException
- if the key could not be translatedpublic static EdKey translateKey(Key key) throws InvalidKeyException
EdKey
.key
- the key objectInvalidKeyException
- if the given key cannot be translated to an EdKey
Copyright © 2011–2022 Stiftung SIC. All rights reserved.