- 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 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 in
PemEncodedandDestroyablethrowUnsupportedOperationExceptions.- 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 voidclose()Close this PEM encoded value and free its related resources.Buffercontent()PemPrivateKeycopy()voiddestroy()StringgetAlgorithm()byte[]getEncoded()StringgetFormat()booleanisDestroyed()protected PemPrivateKeyreceive(Buffer buf)Called when a sentBufferHolderis received by the recipient.static PemPrivateKeyvalueOf(byte[] key)Creates aPemPrivateKeyfrom rawbyte[].static PemPrivateKeyvalueOf(Buffer key)Creates aPemPrivateKeyfrom 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 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(Buffer key)
Creates aPemPrivateKeyfrom 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:BufferHolderCalled when a sentBufferHolderis received by the recipient. TheBufferHoldershould return a new concrete instance, that wraps the givenBufferobject.- Specified by:
receivein classBufferHolder<PemPrivateKey>- Parameters:
buf- TheBufferthat is received by the recipient, and needs to be wrapped in a newBufferHolderinstance.- Returns:
- A new buffer holder instance, containing the given buffer.
-
getEncoded
public byte[] getEncoded()
- Specified by:
getEncodedin interfaceKey
-
getAlgorithm
public String getAlgorithm()
- Specified by:
getAlgorithmin interfaceKey
-
destroy
public void destroy()
- Specified by:
destroyin interfaceDestroyable
-
isDestroyed
public boolean isDestroyed()
- Specified by:
isDestroyedin interfaceDestroyable
-
close
public abstract void close()
Close this PEM encoded value and free its related resources.- Specified by:
closein interfaceAutoCloseable
-
-