Package io.netty.handler.ssl
Class PemPrivateKey
- java.lang.Object
-
- io.netty.util.AbstractReferenceCounted
-
- io.netty.handler.ssl.PemPrivateKey
-
- All Implemented Interfaces:
ByteBufHolder,ReferenceCounted,java.io.Serializable,java.security.Key,java.security.PrivateKey,javax.security.auth.Destroyable
public final class PemPrivateKey extends AbstractReferenceCounted implements java.security.PrivateKey
This is a special purpose implementation of aPrivateKeywhich allows the user to pass PEM/PKCS#8 encoded key material straight intoOpenSslContextwithout having to parse and re-encode bytes in Java land. All methods other than what's implemented inPemEncodedandDestroyablethrowUnsupportedOperationExceptions.- See Also:
PemEncoded,OpenSslContext,valueOf(byte[]),valueOf(ByteBuf), Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteBufcontent()Return the data which is held by thisByteBufHolder.PemPrivateKeycopy()Creates a deep copy of thisByteBufHolder.protected voiddeallocate()Called onceAbstractReferenceCounted.refCnt()is equals 0.voiddestroy()NOTE: This is a JDK8 interface/method.PemPrivateKeyduplicate()Duplicates thisByteBufHolder.java.lang.StringgetAlgorithm()byte[]getEncoded()java.lang.StringgetFormat()booleanisDestroyed()NOTE: This is a JDK8 interface/method.booleanisSensitive()PemPrivateKeyreplace(ByteBuf content)Returns a newByteBufHolderwhich contains the specifiedcontent.PemPrivateKeyretain()Increases the reference count by1.PemPrivateKeyretain(int increment)Increases the reference count by the specifiedincrement.PemPrivateKeyretainedDuplicate()Duplicates thisByteBufHolder.PemPrivateKeytouch()Records the current access location of this object for debugging purposes.PemPrivateKeytouch(java.lang.Object hint)Records the current access location of this object with an additional arbitrary information for debugging purposes.static PemPrivateKeyvalueOf(byte[] key)Creates aPemPrivateKeyfrom rawbyte[].static PemPrivateKeyvalueOf(ByteBuf key)Creates aPemPrivateKeyfrom rawByteBuf.-
Methods inherited from class io.netty.util.AbstractReferenceCounted
refCnt, release, release, setRefCnt
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.netty.util.ReferenceCounted
refCnt, release, release
-
-
-
-
Method Detail
-
valueOf
public static PemPrivateKey valueOf(byte[] key)
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
public static PemPrivateKey valueOf(ByteBuf key)
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()
-
content
public ByteBuf content()
Description copied from interface:ByteBufHolderReturn the data which is held by thisByteBufHolder.- Specified by:
contentin interfaceByteBufHolder
-
copy
public PemPrivateKey copy()
Description copied from interface:ByteBufHolderCreates a deep copy of thisByteBufHolder.- Specified by:
copyin interfaceByteBufHolder
-
duplicate
public PemPrivateKey duplicate()
Description copied from interface:ByteBufHolderDuplicates thisByteBufHolder. Be aware that this will not automatically callByteBufHolder.retain().- Specified by:
duplicatein interfaceByteBufHolder
-
retainedDuplicate
public PemPrivateKey retainedDuplicate()
Description copied from interface:ByteBufHolderDuplicates thisByteBufHolder. This method returns a retained duplicate unlikeByteBufHolder.duplicate().- Specified by:
retainedDuplicatein interfaceByteBufHolder- See Also:
ByteBuf.retainedDuplicate()
-
replace
public PemPrivateKey replace(ByteBuf content)
Description copied from interface:ByteBufHolderReturns a newByteBufHolderwhich contains the specifiedcontent.- Specified by:
replacein interfaceByteBufHolder
-
touch
public PemPrivateKey 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 interfaceReferenceCounted- Overrides:
touchin classAbstractReferenceCounted
-
touch
public PemPrivateKey touch(java.lang.Object hint)
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 interfaceReferenceCounted
-
retain
public PemPrivateKey retain()
Description copied from interface:ReferenceCountedIncreases the reference count by1.- Specified by:
retainin interfaceByteBufHolder- Specified by:
retainin interfaceReferenceCounted- Overrides:
retainin classAbstractReferenceCounted
-
retain
public PemPrivateKey retain(int increment)
Description copied from interface:ReferenceCountedIncreases the reference count by the specifiedincrement.- Specified by:
retainin interfaceByteBufHolder- 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 interfacejava.security.Key
-
getAlgorithm
public java.lang.String getAlgorithm()
- Specified by:
getAlgorithmin interfacejava.security.Key
-
getFormat
public java.lang.String getFormat()
- Specified by:
getFormatin interfacejava.security.Key
-
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 interfacejavax.security.auth.Destroyable- See Also:
Destroyable.destroy()
-
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 interfacejavax.security.auth.Destroyable- See Also:
Destroyable.isDestroyed()
-
-