Package io.netty.handler.ssl.ocsp
Class OcspServerCertificateValidator
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.handler.codec.ByteToMessageDecoder
-
- io.netty.handler.ssl.ocsp.OcspServerCertificateValidator
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler,io.netty.channel.ChannelOutboundHandler
public class OcspServerCertificateValidator extends io.netty.handler.codec.ByteToMessageDecoder implements io.netty.channel.ChannelOutboundHandlerOcspServerCertificateValidatorvalidates incoming server's certificate using OCSP. Once TLS handshake is completed,SslHandshakeCompletionEvent.SUCCESSis fired, validator will perform certificate validation using OCSP over HTTP/1.1 with the server's certificate issuer OCSP responder.
-
-
Field Summary
Fields Modifier and Type Field Description static io.netty.util.AttributeKey<Boolean>OCSP_PIPELINE_ATTRIBUTEAn attribute used to mark all channels created by theOcspServerCertificateValidator.
-
Constructor Summary
Constructors Constructor Description OcspServerCertificateValidator()Create a newOcspServerCertificateValidatorinstance without nonce validation on OCSP response, using defaultIoTransport.DEFAULTinstance, defaultDnsNameResolverimplementation and withcloseAndThrowIfNotValidset totrueOcspServerCertificateValidator(boolean validateNonce)Create a newOcspServerCertificateValidatorinstance with defaultIoTransport.DEFAULTinstance and defaultDnsNameResolverimplementation andcloseAndThrowIfNotValidset totrue.OcspServerCertificateValidator(boolean closeAndThrowIfNotValid, boolean validateNonce, IoTransport ioTransport, io.netty.resolver.dns.DnsNameResolver dnsNameResolver)Create a newIoTransportinstanceOcspServerCertificateValidator(boolean validateNonce, IoTransport ioTransport)Create a newOcspServerCertificateValidatorinstanceOcspServerCertificateValidator(boolean validateNonce, IoTransport ioTransport, io.netty.resolver.dns.DnsNameResolver dnsNameResolver)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbind(io.netty.channel.ChannelHandlerContext ctx, SocketAddress localAddress, io.netty.channel.ChannelPromise promise)voidclose(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise)voidconnect(io.netty.channel.ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, io.netty.channel.ChannelPromise promise)protected static io.netty.resolver.dns.DnsNameResolvercreateDefaultResolver(IoTransport ioTransport)protected voiddecode(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf in, List<Object> out)voidderegister(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise)voiddisconnect(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise)voidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)voidflush(io.netty.channel.ChannelHandlerContext ctx)voidread(io.netty.channel.ChannelHandlerContext ctx)voiduserEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt)voidwrite(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise promise)-
Methods inherited from class io.netty.handler.codec.ByteToMessageDecoder
actualReadableBytes, callDecode, channelInactive, channelRead, channelReadComplete, decodeLast, discardSomeReadBytes, handlerRemoved, handlerRemoved0, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode
-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelRegistered, channelUnregistered, channelWritabilityChanged
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, isSharable
-
-
-
-
Field Detail
-
OCSP_PIPELINE_ATTRIBUTE
public static final io.netty.util.AttributeKey<Boolean> OCSP_PIPELINE_ATTRIBUTE
An attribute used to mark all channels created by theOcspServerCertificateValidator.
-
-
Constructor Detail
-
OcspServerCertificateValidator
public OcspServerCertificateValidator()
Create a newOcspServerCertificateValidatorinstance without nonce validation on OCSP response, using defaultIoTransport.DEFAULTinstance, defaultDnsNameResolverimplementation and withcloseAndThrowIfNotValidset totrue
-
OcspServerCertificateValidator
public OcspServerCertificateValidator(boolean validateNonce)
Create a newOcspServerCertificateValidatorinstance with defaultIoTransport.DEFAULTinstance and defaultDnsNameResolverimplementation andcloseAndThrowIfNotValidset totrue.- Parameters:
validateNonce- Set totrueif we should force nonce validation on OCSP response else set tofalse
-
OcspServerCertificateValidator
public OcspServerCertificateValidator(boolean validateNonce, IoTransport ioTransport)Create a newOcspServerCertificateValidatorinstance- Parameters:
validateNonce- Set totrueif we should force nonce validation on OCSP response else set tofalseioTransport-IoTransportto use
-
OcspServerCertificateValidator
public OcspServerCertificateValidator(boolean validateNonce, IoTransport ioTransport, io.netty.resolver.dns.DnsNameResolver dnsNameResolver)- Parameters:
validateNonce- Set totrueif we should force nonce validation on OCSP response else set tofalseioTransport-IoTransportto usednsNameResolver-DnsNameResolverimplementation to use
-
OcspServerCertificateValidator
public OcspServerCertificateValidator(boolean closeAndThrowIfNotValid, boolean validateNonce, IoTransport ioTransport, io.netty.resolver.dns.DnsNameResolver dnsNameResolver)Create a newIoTransportinstance- Parameters:
closeAndThrowIfNotValid- If set totruethen we will close the channel and throw an exception when certificate is notOcspResponse.Status.VALID. If set tofalsethen we will simply pass theOcspValidationEventto the next handler in pipeline and let it decide what to do.validateNonce- Set totrueif we should force nonce validation on OCSP response else set tofalseioTransport-IoTransportto usednsNameResolver-DnsNameResolverimplementation to use
-
-
Method Detail
-
createDefaultResolver
protected static io.netty.resolver.dns.DnsNameResolver createDefaultResolver(IoTransport ioTransport)
-
decode
protected void decode(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf in, List<Object> out)- Specified by:
decodein classio.netty.handler.codec.ByteToMessageDecoder
-
userEventTriggered
public void userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt) throws Exception- Specified by:
userEventTriggeredin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
userEventTriggeredin classio.netty.handler.codec.ByteToMessageDecoder- Throws:
Exception
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
exceptionCaughtin classio.netty.channel.ChannelInboundHandlerAdapter
-
bind
public void bind(io.netty.channel.ChannelHandlerContext ctx, SocketAddress localAddress, io.netty.channel.ChannelPromise promise) throws Exception- Specified by:
bindin interfaceio.netty.channel.ChannelOutboundHandler- Throws:
Exception
-
connect
public void connect(io.netty.channel.ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, io.netty.channel.ChannelPromise promise) throws Exception- Specified by:
connectin interfaceio.netty.channel.ChannelOutboundHandler- Throws:
Exception
-
disconnect
public void disconnect(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise) throws Exception- Specified by:
disconnectin interfaceio.netty.channel.ChannelOutboundHandler- Throws:
Exception
-
close
public void close(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise) throws Exception- Specified by:
closein interfaceio.netty.channel.ChannelOutboundHandler- Throws:
Exception
-
deregister
public void deregister(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise) throws Exception- Specified by:
deregisterin interfaceio.netty.channel.ChannelOutboundHandler- Throws:
Exception
-
read
public void read(io.netty.channel.ChannelHandlerContext ctx) throws Exception- Specified by:
readin interfaceio.netty.channel.ChannelOutboundHandler- Throws:
Exception
-
write
public void write(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise promise) throws Exception- Specified by:
writein interfaceio.netty.channel.ChannelOutboundHandler- Throws:
Exception
-
-