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 aPrivateKey
which allows the user to pass PEM/PKCS#8 encoded key material straight intoOpenSslContext
without having to parse and re-encode bytes in Java land. All methods other than what's implemented inPemEncoded
andDestroyable
throwUnsupportedOperationException
s.- 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 ByteBuf
content()
Return the data which is held by thisByteBufHolder
.PemPrivateKey
copy()
Creates a deep copy of thisByteBufHolder
.protected void
deallocate()
Called onceAbstractReferenceCounted.refCnt()
is equals 0.void
destroy()
NOTE: This is a JDK8 interface/method.PemPrivateKey
duplicate()
Duplicates thisByteBufHolder
.java.lang.String
getAlgorithm()
byte[]
getEncoded()
java.lang.String
getFormat()
boolean
isDestroyed()
NOTE: This is a JDK8 interface/method.boolean
isSensitive()
PemPrivateKey
replace(ByteBuf content)
Returns a newByteBufHolder
which contains the specifiedcontent
.PemPrivateKey
retain()
Increases the reference count by1
.PemPrivateKey
retain(int increment)
Increases the reference count by the specifiedincrement
.PemPrivateKey
retainedDuplicate()
Duplicates thisByteBufHolder
.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 aPemPrivateKey
from rawbyte[]
.static PemPrivateKey
valueOf(ByteBuf key)
Creates aPemPrivateKey
from 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 aPemPrivateKey
from 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 aPemPrivateKey
from 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:ByteBufHolder
Return the data which is held by thisByteBufHolder
.- Specified by:
content
in interfaceByteBufHolder
-
copy
public PemPrivateKey copy()
Description copied from interface:ByteBufHolder
Creates a deep copy of thisByteBufHolder
.- Specified by:
copy
in interfaceByteBufHolder
-
duplicate
public PemPrivateKey duplicate()
Description copied from interface:ByteBufHolder
Duplicates thisByteBufHolder
. Be aware that this will not automatically callByteBufHolder.retain()
.- Specified by:
duplicate
in interfaceByteBufHolder
-
retainedDuplicate
public PemPrivateKey retainedDuplicate()
Description copied from interface:ByteBufHolder
Duplicates thisByteBufHolder
. This method returns a retained duplicate unlikeByteBufHolder.duplicate()
.- Specified by:
retainedDuplicate
in interfaceByteBufHolder
- See Also:
ByteBuf.retainedDuplicate()
-
replace
public PemPrivateKey replace(ByteBuf content)
Description copied from interface:ByteBufHolder
Returns a newByteBufHolder
which contains the specifiedcontent
.- Specified by:
replace
in interfaceByteBufHolder
-
touch
public PemPrivateKey touch()
Description copied from interface:ReferenceCounted
Records 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:
touch
in interfaceByteBufHolder
- Specified by:
touch
in interfaceReferenceCounted
- Overrides:
touch
in classAbstractReferenceCounted
-
touch
public PemPrivateKey touch(java.lang.Object hint)
Description copied from interface:ReferenceCounted
Records 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:
touch
in interfaceByteBufHolder
- Specified by:
touch
in interfaceReferenceCounted
-
retain
public PemPrivateKey retain()
Description copied from interface:ReferenceCounted
Increases the reference count by1
.- Specified by:
retain
in interfaceByteBufHolder
- Specified by:
retain
in interfaceReferenceCounted
- Overrides:
retain
in classAbstractReferenceCounted
-
retain
public PemPrivateKey retain(int increment)
Description copied from interface:ReferenceCounted
Increases the reference count by the specifiedincrement
.- Specified by:
retain
in interfaceByteBufHolder
- Specified by:
retain
in interfaceReferenceCounted
- Overrides:
retain
in classAbstractReferenceCounted
-
deallocate
protected void deallocate()
Description copied from class:AbstractReferenceCounted
Called onceAbstractReferenceCounted.refCnt()
is equals 0.- Specified by:
deallocate
in classAbstractReferenceCounted
-
getEncoded
public byte[] getEncoded()
- Specified by:
getEncoded
in interfacejava.security.Key
-
getAlgorithm
public java.lang.String getAlgorithm()
- Specified by:
getAlgorithm
in interfacejava.security.Key
-
getFormat
public java.lang.String getFormat()
- Specified by:
getFormat
in 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@Override
annotation onto this method.- Specified by:
destroy
in 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@Override
annotation onto this method.- Specified by:
isDestroyed
in interfacejavax.security.auth.Destroyable
- See Also:
Destroyable.isDestroyed()
-
-