- java.lang.Object
-
- io.netty5.buffer.api.BufferHolder<PemPrivateKey>
-
- io.netty5.handler.ssl.PemPrivateKey
-
- All Implemented Interfaces:
Resource<PemPrivateKey>
,Serializable
,AutoCloseable
,Key
,PrivateKey
,Destroyable
public final class PemPrivateKey extends BufferHolder<PemPrivateKey> implements 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 in
PemEncoded
andDestroyable
throwUnsupportedOperationException
s.- See Also:
PemEncoded
,OpenSslContext
,valueOf(byte[])
,valueOf(Buffer)
, Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
Close this PEM encoded value and free its related resources.Buffer
content()
PemPrivateKey
copy()
void
destroy()
String
getAlgorithm()
byte[]
getEncoded()
String
getFormat()
boolean
isDestroyed()
protected PemPrivateKey
receive(Buffer buf)
Called when a sentBufferHolder
is received by the recipient.static PemPrivateKey
valueOf(byte[] key)
Creates aPemPrivateKey
from rawbyte[]
.static PemPrivateKey
valueOf(Buffer key)
Creates aPemPrivateKey
from rawBuffer
.-
Methods inherited from class io.netty5.buffer.api.BufferHolder
close, equals, getBuffer, getBufferVolatile, hashCode, isAccessible, replaceBuffer, replaceBufferVolatile, send, touch
-
-
-
-
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(Buffer key)
Creates aPemPrivateKey
from rawBuffer
. ATTENTION: It's assumed that the given argument is a PEM/PKCS#8 encoded value. No input validation is performed to validate it.
-
content
public Buffer content()
-
copy
public PemPrivateKey copy()
-
receive
protected PemPrivateKey receive(Buffer buf)
Description copied from class:BufferHolder
Called when a sentBufferHolder
is received by the recipient. TheBufferHolder
should return a new concrete instance, that wraps the givenBuffer
object.- Specified by:
receive
in classBufferHolder<PemPrivateKey>
- Parameters:
buf
- TheBuffer
that is received by the recipient, and needs to be wrapped in a newBufferHolder
instance.- Returns:
- A new buffer holder instance, containing the given buffer.
-
getEncoded
public byte[] getEncoded()
- Specified by:
getEncoded
in interfaceKey
-
getAlgorithm
public String getAlgorithm()
- Specified by:
getAlgorithm
in interfaceKey
-
destroy
public void destroy()
- Specified by:
destroy
in interfaceDestroyable
-
isDestroyed
public boolean isDestroyed()
- Specified by:
isDestroyed
in interfaceDestroyable
-
close
public abstract void close()
Close this PEM encoded value and free its related resources.- Specified by:
close
in interfaceAutoCloseable
-
-