Package org.cryptacular.adapter
Class AbstractWrappedKey<T extends org.bouncycastle.crypto.params.AsymmetricKeyParameter>
java.lang.Object
org.cryptacular.adapter.AbstractWrappedKey<T>
- Type Parameters:
T
- Asymmetric key parameters type wrapped by this class.
- All Implemented Interfaces:
Serializable
,Key
- Direct Known Subclasses:
AbstractWrappedDSAKey
,AbstractWrappedECKey
,AbstractWrappedRSAKey
public abstract class AbstractWrappedKey<T extends org.bouncycastle.crypto.params.AsymmetricKeyParameter>
extends Object
implements Key
JCE/JDK key base class that wraps a BC native private key.
- Author:
- Middleware Services
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final T
Wrapped key.static final String
PKCS#8 format identifier used with private keys.static final String
X.509 format identifier used with private keys.Fields inherited from interface java.security.Key
serialVersionUID
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractWrappedKey
(T wrappedKey) Creates a new instance that wraps the given BC key. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.security.Key
getAlgorithm
-
Field Details
-
PKCS8_FORMAT
PKCS#8 format identifier used with private keys.- See Also:
-
X509_FORMAT
X.509 format identifier used with private keys.- See Also:
-
delegate
Wrapped key.
-
-
Constructor Details
-
AbstractWrappedKey
Creates a new instance that wraps the given BC key.- Parameters:
wrappedKey
- BC key to wrap.
-
-
Method Details
-
getFormat
- Specified by:
getFormat
in interfaceKey
- Returns:
- "PKCS#8" in the case of a private key, otherwise
X509_FORMAT
.
-
getEncoded
public byte[] getEncoded()- Specified by:
getEncoded
in interfaceKey
- Returns:
- Encoded PrivateKeyInfo structure in the case of a private key, otherwise an encoded SubjectPublicKeyInfo structure.
-