x509-ocsp-0.2.0.0: Basic X509 OCSP implementation
Copyright(c) Alexey Radkov 2024
LicenseBSD-style
Maintaineralexey.radkov@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.X509.OCSP

Description

Encode and decode X509 OCSP requests and responses.

This module complies with rfc6960.

Synopsis

Documentation

data CertId Source #

Certificate Id.

This data is used when building OCSP requests and parsing OCSP responses.

Constructors

CertId 

Fields

Instances

Instances details
Show CertId Source # 
Instance details

Defined in Data.X509.OCSP

Eq CertId Source # 
Instance details

Defined in Data.X509.OCSP

Methods

(==) :: CertId -> CertId -> Bool #

(/=) :: CertId -> CertId -> Bool #

encodeOCSPRequestASN1 Source #

Arguments

:: Certificate

Certificate

-> Certificate

Issuer certificate

-> ([ASN1], CertId) 

Build and encode OCSP request in ASN.1 format.

The returned value contains the encoded request and an object of type CertId with hashes calculated by the SHA1 algorithm.

encodeOCSPRequest Source #

Arguments

:: Certificate

Certificate

-> Certificate

Issuer certificate

-> (ByteString, CertId) 

Build and encode OCSP request in ASN.1/DER format.

The returned value contains the encoded request and an object of type CertId with hashes calculated by the SHA1 algorithm.

data OCSPResponse Source #

OCSP response data.

Constructors

OCSPResponse 

Fields

Instances

Instances details
Show OCSPResponse Source # 
Instance details

Defined in Data.X509.OCSP

Eq OCSPResponse Source # 
Instance details

Defined in Data.X509.OCSP

data OCSPResponsePayload Source #

Payload data of OCSP response.

Constructors

OCSPResponsePayload 

Fields

data OCSPResponseCertData Source #

Selected certificate data of OCSP response.

Constructors

OCSPResponseCertData 

Fields

decodeOCSPResponse Source #

Arguments

:: CertId

Certificate Id

-> ByteString

OCSP response

-> Either ASN1Error (Maybe OCSPResponse) 

Decode OCSP response.

The value of the certificate id is expected to be equal to what was returned by encodeOCSPRequest as it is used to check the correctness of the response.

The Left value gets returned on parse errors detected by decodeASN1. The Right value with Nothing gets returned on unexpected ASN.1 contents.