Class PemPrivateKey
java.lang.Object
io.netty.util.AbstractReferenceCounted
io.netty.handler.ssl.PemPrivateKey
- All Implemented Interfaces:
ByteBufHolder, PemEncoded, ReferenceCounted, Serializable, Key, PrivateKey, Destroyable
This is a special purpose implementation of a
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.- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncontent()Return the data which is held by thisByteBufHolder.copy()Creates a deep copy of thisByteBufHolder.protected voidCalled onceAbstractReferenceCounted.refCnt()is equals 0.voiddestroy()NOTE: This is a JDK8 interface/method.Duplicates thisByteBufHolder.byte[]booleanNOTE: This is a JDK8 interface/method.booleanReturnstrueif the PEM encoded value is considered sensitive information such as a private key.Returns a newByteBufHolderwhich contains the specifiedcontent.retain()Increases the reference count by1.retain(int increment) Increases the reference count by the specifiedincrement.Duplicates thisByteBufHolder.(package private) static PemEncodedtoPEM(ByteBufAllocator allocator, boolean useDirect, byte[] bytes) (package private) static PemEncodedtoPEM(ByteBufAllocator allocator, boolean useDirect, PrivateKey key) Creates aPemEncodedvalue from thePrivateKey.touch()Records the current access location of this object for debugging purposes.Records the current access location of this object with an additional arbitrary information for debugging purposes.static PemPrivateKeyvalueOf(byte[] key) Creates aPemPrivateKeyfrom rawbyte[].static PemPrivateKeyCreates aPemPrivateKeyfrom rawByteBuf.Methods inherited from class AbstractReferenceCounted
refCnt, release, release, setRefCntMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ReferenceCounted
refCnt, release, release
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
BEGIN_PRIVATE_KEY
private static final byte[] BEGIN_PRIVATE_KEY -
END_PRIVATE_KEY
private static final byte[] END_PRIVATE_KEY -
PKCS8_FORMAT
- See Also:
-
-
-
Constructor Details
-
PemPrivateKey
-
-
Method Details
-
toPEM
Creates aPemEncodedvalue from thePrivateKey. -
toPEM
-
valueOf
Creates aPemPrivateKeyfrom rawbyte[]. ATTENTION: It's assumed that the given argument is a PEM/PKCS#8 encoded value. No input validation is performed to validate it. -
valueOf
Creates aPemPrivateKeyfrom rawByteBuf. ATTENTION: It's assumed that the given argument is a PEM/PKCS#8 encoded value. No input validation is performed to validate it. -
isSensitive
public boolean isSensitive()Description copied from interface:PemEncodedReturnstrueif the PEM encoded value is considered sensitive information such as a private key.- Specified by:
isSensitivein interfacePemEncoded
-
content
Description copied from interface:ByteBufHolderReturn the data which is held by thisByteBufHolder.- Specified by:
contentin interfaceByteBufHolder
-
copy
Description copied from interface:ByteBufHolderCreates a deep copy of thisByteBufHolder.- Specified by:
copyin interfaceByteBufHolder- Specified by:
copyin interfacePemEncoded
-
duplicate
Description copied from interface:ByteBufHolderDuplicates thisByteBufHolder. Be aware that this will not automatically callByteBufHolder.retain().- Specified by:
duplicatein interfaceByteBufHolder- Specified by:
duplicatein interfacePemEncoded
-
retainedDuplicate
Description copied from interface:ByteBufHolderDuplicates thisByteBufHolder. This method returns a retained duplicate unlikeByteBufHolder.duplicate().- Specified by:
retainedDuplicatein interfaceByteBufHolder- Specified by:
retainedDuplicatein interfacePemEncoded- See Also:
-
replace
Description copied from interface:ByteBufHolderReturns a newByteBufHolderwhich contains the specifiedcontent.- Specified by:
replacein interfaceByteBufHolder- Specified by:
replacein interfacePemEncoded
-
touch
Description copied from interface:ReferenceCountedRecords the current access location of this object for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you viaResourceLeakDetector. This method is a shortcut totouch(null).- Specified by:
touchin interfaceByteBufHolder- Specified by:
touchin interfacePemEncoded- Specified by:
touchin interfaceReferenceCounted- Overrides:
touchin classAbstractReferenceCounted
-
touch
Description copied from interface:ReferenceCountedRecords the current access location of this object with an additional arbitrary information for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you viaResourceLeakDetector.- Specified by:
touchin interfaceByteBufHolder- Specified by:
touchin interfacePemEncoded- Specified by:
touchin interfaceReferenceCounted
-
retain
Description copied from interface:ReferenceCountedIncreases the reference count by1.- Specified by:
retainin interfaceByteBufHolder- Specified by:
retainin interfacePemEncoded- Specified by:
retainin interfaceReferenceCounted- Overrides:
retainin classAbstractReferenceCounted
-
retain
Description copied from interface:ReferenceCountedIncreases the reference count by the specifiedincrement.- Specified by:
retainin interfaceByteBufHolder- Specified by:
retainin interfacePemEncoded- Specified by:
retainin interfaceReferenceCounted- Overrides:
retainin classAbstractReferenceCounted
-
deallocate
protected void deallocate()Description copied from class:AbstractReferenceCountedCalled onceAbstractReferenceCounted.refCnt()is equals 0.- Specified by:
deallocatein classAbstractReferenceCounted
-
getEncoded
public byte[] getEncoded()- Specified by:
getEncodedin interfaceKey
-
getAlgorithm
- Specified by:
getAlgorithmin interfaceKey
-
getFormat
-
destroy
public void destroy()NOTE: This is a JDK8 interface/method. Due to backwards compatibility reasons it's not possible to slap the@Overrideannotation onto this method.- Specified by:
destroyin interfaceDestroyable- See Also:
-
isDestroyed
public boolean isDestroyed()NOTE: This is a JDK8 interface/method. Due to backwards compatibility reasons it's not possible to slap the@Overrideannotation onto this method.- Specified by:
isDestroyedin interfaceDestroyable- See Also:
-