public final class PemPrivateKey extends AbstractReferenceCounted implements java.security.PrivateKey, PemEncoded
PrivateKey which allows the
user to pass PEM/PKCS#8 encoded key material straight into OpenSslContext
without having to parse and re-encode bytes in Java land.
All methods other than what's implemented in PemEncoded and Destroyable
throw UnsupportedOperationExceptions.PemEncoded,
OpenSslContext,
valueOf(byte[]),
valueOf(ByteBuf),
Serialized Form| Modifier and Type | Field and Description |
|---|---|
private static byte[] |
BEGIN_PRIVATE_KEY |
private ByteBuf |
content |
private static byte[] |
END_PRIVATE_KEY |
private static java.lang.String |
PKCS8_FORMAT |
| Modifier | Constructor and Description |
|---|---|
private |
PemPrivateKey(ByteBuf content) |
| Modifier and Type | Method and Description |
|---|---|
ByteBuf |
content()
Return the data which is held by this
ByteBufHolder. |
PemPrivateKey |
copy()
Creates a deep copy of this
ByteBufHolder. |
protected void |
deallocate()
Called once
AbstractReferenceCounted.refCnt() is equals 0. |
void |
destroy()
NOTE: This is a JDK8 interface/method.
|
PemPrivateKey |
duplicate()
Duplicates this
ByteBufHolder. |
java.lang.String |
getAlgorithm() |
byte[] |
getEncoded() |
java.lang.String |
getFormat() |
boolean |
isDestroyed()
NOTE: This is a JDK8 interface/method.
|
boolean |
isSensitive()
Returns
true if the PEM encoded value is considered
sensitive information such as a private key. |
PemPrivateKey |
replace(ByteBuf content)
Returns a new
ByteBufHolder which contains the specified content. |
PemPrivateKey |
retain()
Increases the reference count by
1. |
PemPrivateKey |
retain(int increment)
Increases the reference count by the specified
increment. |
PemPrivateKey |
retainedDuplicate()
Duplicates this
ByteBufHolder. |
(package private) static PemEncoded |
toPEM(ByteBufAllocator allocator,
boolean useDirect,
java.security.PrivateKey key)
Creates a
PemEncoded value from the PrivateKey. |
PemPrivateKey |
touch()
Records the current access location of this object for debugging purposes.
|
PemPrivateKey |
touch(java.lang.Object hint)
Records the current access location of this object with an additional arbitrary information for debugging
purposes.
|
static PemPrivateKey |
valueOf(byte[] key)
Creates a
PemPrivateKey from raw byte[]. |
static PemPrivateKey |
valueOf(ByteBuf key)
Creates a
PemPrivateKey from raw ByteBuf. |
refCnt, release, release, setRefCntclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitrefCnt, release, releaseprivate static final byte[] BEGIN_PRIVATE_KEY
private static final byte[] END_PRIVATE_KEY
private static final java.lang.String PKCS8_FORMAT
private final ByteBuf content
private PemPrivateKey(ByteBuf content)
static PemEncoded toPEM(ByteBufAllocator allocator, boolean useDirect, java.security.PrivateKey key)
PemEncoded value from the PrivateKey.public static PemPrivateKey valueOf(byte[] key)
PemPrivateKey from raw byte[].
ATTENTION: It's assumed that the given argument is a PEM/PKCS#8 encoded value.
No input validation is performed to validate it.public static PemPrivateKey valueOf(ByteBuf key)
PemPrivateKey from raw ByteBuf.
ATTENTION: It's assumed that the given argument is a PEM/PKCS#8 encoded value.
No input validation is performed to validate it.public boolean isSensitive()
PemEncodedtrue if the PEM encoded value is considered
sensitive information such as a private key.isSensitive in interface PemEncodedpublic ByteBuf content()
ByteBufHolderByteBufHolder.content in interface ByteBufHolderpublic PemPrivateKey copy()
ByteBufHolderByteBufHolder.copy in interface ByteBufHoldercopy in interface PemEncodedpublic PemPrivateKey duplicate()
ByteBufHolderByteBufHolder. Be aware that this will not automatically call ByteBufHolder.retain().duplicate in interface ByteBufHolderduplicate in interface PemEncodedpublic PemPrivateKey retainedDuplicate()
ByteBufHolderByteBufHolder. This method returns a retained duplicate unlike ByteBufHolder.duplicate().retainedDuplicate in interface ByteBufHolderretainedDuplicate in interface PemEncodedByteBuf.retainedDuplicate()public PemPrivateKey replace(ByteBuf content)
ByteBufHolderByteBufHolder which contains the specified content.replace in interface ByteBufHolderreplace in interface PemEncodedpublic PemPrivateKey touch()
ReferenceCountedResourceLeakDetector. This method is a shortcut to touch(null).touch in interface ByteBufHoldertouch in interface PemEncodedtouch in interface ReferenceCountedtouch in class AbstractReferenceCountedpublic PemPrivateKey touch(java.lang.Object hint)
ReferenceCountedResourceLeakDetector.touch in interface ByteBufHoldertouch in interface PemEncodedtouch in interface ReferenceCountedpublic PemPrivateKey retain()
ReferenceCounted1.retain in interface ByteBufHolderretain in interface PemEncodedretain in interface ReferenceCountedretain in class AbstractReferenceCountedpublic PemPrivateKey retain(int increment)
ReferenceCountedincrement.retain in interface ByteBufHolderretain in interface PemEncodedretain in interface ReferenceCountedretain in class AbstractReferenceCountedprotected void deallocate()
AbstractReferenceCountedAbstractReferenceCounted.refCnt() is equals 0.deallocate in class AbstractReferenceCountedpublic byte[] getEncoded()
getEncoded in interface java.security.Keypublic java.lang.String getAlgorithm()
getAlgorithm in interface java.security.Keypublic java.lang.String getFormat()
getFormat in interface java.security.Keypublic void destroy()
@Override annotation onto
this method.destroy in interface javax.security.auth.DestroyableDestroyable.destroy()public boolean isDestroyed()
@Override annotation onto
this method.isDestroyed in interface javax.security.auth.DestroyableDestroyable.isDestroyed()