public final class ECKeyFactory extends KeyFactorySpi
ECPublicKey <--> ECPublicKeySpec, X509EncodedKeySpec, java.security.spec.ECPublicKeySpec ECPrivateKey <--> ECPrivateKeySpec, PKCS8EncodedKeySpec, java.security.spec.ECPrivateKeySpec
ECKey
,
ECPrivateKey
,
ECPrivateKeySpec
,
ECPublicKey
,
ECPublicKeySpec
Constructor and Description |
---|
ECKeyFactory()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected PrivateKey |
engineGeneratePrivate(KeySpec keySpec)
Generates a private key from the given key spec.
|
protected PublicKey |
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 ECKey |
translateKey(Key key)
Translates a key to an
ECKey . |
protected PublicKey engineGeneratePublic(KeySpec keySpec) throws InvalidKeySpecException
engineGeneratePublic
in class KeyFactorySpi
keySpec
- the key spec may be a X509EncodedKeySpec
or a
ECPublicKeySpec
.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 ECPrivateKeySpec
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 ECPublicKey
or
ECPrivateKey
)keySpec
- the key specification type. If the given key is of type
ECPublicKey
the keySpec may be ECPublicKeySpec
or
X509EncodedKeySpec
. Otherwise (key is of type
ECPrivateKey
) the keySpec may be ECPrivateKeySpec
or PKCS8EncodedKeySpec
InvalidKeySpecException
- if the key cannot be transformed into the provided keySpec.protected Key engineTranslateKey(Key key) throws InvalidKeyException
ECPublicKey
or ECPrivateKey
.engineTranslateKey
in class KeyFactorySpi
key
- the key to be translatedInvalidKeyException
- if the given key cannot be translatedpublic static ECKey translateKey(Key key) throws InvalidKeyException
ECKey
.key
- the key objectInvalidKeyException
- if the given key cannot be translated to an ECKey
Copyright © 2011–2022 Stiftung SIC. All rights reserved.