public final class EdDSAKeyFactory extends EdKeyFactory
EdPublicKey <--> EdPublicKeySpec, X509EncodedKeySpec EdDSAPrivateKey <--> EdDSAPrivateKeySpec, PKCS8EncodedKeySpec
EdKey
,
EdDSAPrivateKey
,
EdDSAPrivateKeySpec
,
EdPublicKey
,
EdPublicKeySpec
Constructor and Description |
---|
EdDSAKeyFactory()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected PrivateKey |
engineGeneratePrivate(KeySpec keySpec)
Generates a private 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 . |
engineGeneratePublic, translatePublicKey
protected PrivateKey engineGeneratePrivate(KeySpec keySpec) throws InvalidKeySpecException
engineGeneratePrivate
in class EdKeyFactory
keySpec
- the key material; it may either be EdDSAPrivateKeySpec
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 EdKeyFactory
key
- the key to be converted (either EdPublicKey
or
EdDSAPrivateKey
)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
EdDSAPrivateKey
) the keySpec may be
EdDSAPrivateKeySpec
or PKCS8EncodedKeySpec
InvalidKeySpecException
- if the key cannot be transformed into the provided keySpec.protected Key engineTranslateKey(Key key) throws InvalidKeyException
EdPublicKey
or EdDSAPrivateKey
.engineTranslateKey
in class EdKeyFactory
key
- the key to be translatedInvalidKeyException
- if the given key cannot 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.