x509-1.7.7: X509 reader and writer
LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
Stabilityexperimental
Portabilityunknown
Safe HaskellNone
LanguageHaskell2010

Data.X509

Description

Read/Write X509 Certificate, CRL and their signed equivalents.

Follows RFC5280 / RFC6818

Synopsis

Types

type SignedCertificate = SignedExact Certificate Source #

A Signed Certificate

type SignedCRL = SignedExact CRL Source #

A Signed CRL

data Certificate Source #

X.509 Certificate type.

This type doesn't include the signature, it's describe in the RFC as tbsCertificate.

Constructors

Certificate 

Fields

Instances

Instances details
ASN1Object Certificate Source # 
Instance details

Defined in Data.X509.Cert

Methods

toASN1 :: Certificate -> ASN1S

fromASN1 :: [ASN1] -> Either String (Certificate, [ASN1])

Show Certificate Source # 
Instance details

Defined in Data.X509.Cert

Methods

showsPrec :: Int -> Certificate -> ShowS

show :: Certificate -> String

showList :: [Certificate] -> ShowS

Eq Certificate Source # 
Instance details

Defined in Data.X509.Cert

Methods

(==) :: Certificate -> Certificate -> Bool

(/=) :: Certificate -> Certificate -> Bool

data PubKey Source #

Public key types known and used in X.509

Constructors

PubKeyRSA PublicKey

RSA public key

PubKeyDSA PublicKey

DSA public key

PubKeyDH (Integer, Integer, Integer, Maybe Integer, ([Word8], Integer))

DH format with (p,g,q,j,(seed,pgenCounter))

PubKeyEC PubKeyEC

EC public key

PubKeyX25519 PublicKey

X25519 public key

PubKeyX448 PublicKey

X448 public key

PubKeyEd25519 PublicKey

Ed25519 public key

PubKeyEd448 PublicKey

Ed448 public key

PubKeyUnknown OID ByteString

unrecognized format

Instances

Instances details
ASN1Object PubKey Source # 
Instance details

Defined in Data.X509.PublicKey

Methods

toASN1 :: PubKey -> ASN1S

fromASN1 :: [ASN1] -> Either String (PubKey, [ASN1])

Show PubKey Source # 
Instance details

Defined in Data.X509.PublicKey

Methods

showsPrec :: Int -> PubKey -> ShowS

show :: PubKey -> String

showList :: [PubKey] -> ShowS

Eq PubKey Source # 
Instance details

Defined in Data.X509.PublicKey

Methods

(==) :: PubKey -> PubKey -> Bool

(/=) :: PubKey -> PubKey -> Bool

data PubKeyEC Source #

Elliptic Curve Public Key

TODO: missing support for binary curve.

Constructors

PubKeyEC_Prime 

Fields

PubKeyEC_Named 

Fields

Instances

Instances details
Show PubKeyEC Source # 
Instance details

Defined in Data.X509.PublicKey

Methods

showsPrec :: Int -> PubKeyEC -> ShowS

show :: PubKeyEC -> String

showList :: [PubKeyEC] -> ShowS

Eq PubKeyEC Source # 
Instance details

Defined in Data.X509.PublicKey

Methods

(==) :: PubKeyEC -> PubKeyEC -> Bool

(/=) :: PubKeyEC -> PubKeyEC -> Bool

newtype SerializedPoint Source #

Serialized Elliptic Curve Point

Constructors

SerializedPoint ByteString 

Instances

Instances details
Show SerializedPoint Source # 
Instance details

Defined in Data.X509.PublicKey

Methods

showsPrec :: Int -> SerializedPoint -> ShowS

show :: SerializedPoint -> String

showList :: [SerializedPoint] -> ShowS

Eq SerializedPoint Source # 
Instance details

Defined in Data.X509.PublicKey

data PrivKey Source #

Private key types known and used in X.509

Constructors

PrivKeyRSA PrivateKey

RSA private key

PrivKeyDSA PrivateKey

DSA private key

PrivKeyEC PrivKeyEC

EC private key

PrivKeyX25519 SecretKey

X25519 private key

PrivKeyX448 SecretKey

X448 private key

PrivKeyEd25519 SecretKey

Ed25519 private key

PrivKeyEd448 SecretKey

Ed448 private key

Instances

Instances details
ASN1Object PrivKey Source # 
Instance details

Defined in Data.X509.PrivateKey

Methods

toASN1 :: PrivKey -> ASN1S

fromASN1 :: [ASN1] -> Either String (PrivKey, [ASN1])

Show PrivKey Source # 
Instance details

Defined in Data.X509.PrivateKey

Methods

showsPrec :: Int -> PrivKey -> ShowS

show :: PrivKey -> String

showList :: [PrivKey] -> ShowS

Eq PrivKey Source # 
Instance details

Defined in Data.X509.PrivateKey

Methods

(==) :: PrivKey -> PrivKey -> Bool

(/=) :: PrivKey -> PrivKey -> Bool

data PrivKeyEC Source #

Elliptic Curve Private Key

TODO: missing support for binary curve.

Constructors

PrivKeyEC_Prime 

Fields

PrivKeyEC_Named 

Fields

Instances

Instances details
Show PrivKeyEC Source # 
Instance details

Defined in Data.X509.PrivateKey

Methods

showsPrec :: Int -> PrivKeyEC -> ShowS

show :: PrivKeyEC -> String

showList :: [PrivKeyEC] -> ShowS

Eq PrivKeyEC Source # 
Instance details

Defined in Data.X509.PrivateKey

Methods

(==) :: PrivKeyEC -> PrivKeyEC -> Bool

(/=) :: PrivKeyEC -> PrivKeyEC -> Bool

pubkeyToAlg :: PubKey -> PubKeyALG Source #

Convert a Public key to the Public Key Algorithm type

privkeyToAlg :: PrivKey -> PubKeyALG Source #

Convert a Private key to the Public Key Algorithm type

data HashALG Source #

Hash Algorithm

Instances

Instances details
Show HashALG Source # 
Instance details

Defined in Data.X509.AlgorithmIdentifier

Methods

showsPrec :: Int -> HashALG -> ShowS

show :: HashALG -> String

showList :: [HashALG] -> ShowS

Eq HashALG Source # 
Instance details

Defined in Data.X509.AlgorithmIdentifier

Methods

(==) :: HashALG -> HashALG -> Bool

(/=) :: HashALG -> HashALG -> Bool

data PubKeyALG Source #

Public Key Algorithm

Constructors

PubKeyALG_RSA

RSA Public Key algorithm

PubKeyALG_RSAPSS

RSA PSS Key algorithm (RFC 3447)

PubKeyALG_DSA

DSA Public Key algorithm

PubKeyALG_EC

ECDSA & ECDH Public Key algorithm

PubKeyALG_X25519

ECDH 25519 key agreement

PubKeyALG_X448

ECDH 448 key agreement

PubKeyALG_Ed25519

EdDSA 25519 signature algorithm

PubKeyALG_Ed448

EdDSA 448 signature algorithm

PubKeyALG_DH

Diffie Hellman Public Key algorithm

PubKeyALG_Unknown OID

Unknown Public Key algorithm

Instances

Instances details
OIDable PubKeyALG Source # 
Instance details

Defined in Data.X509.AlgorithmIdentifier

Methods

getObjectID :: PubKeyALG -> OID

Show PubKeyALG Source # 
Instance details

Defined in Data.X509.AlgorithmIdentifier

Methods

showsPrec :: Int -> PubKeyALG -> ShowS

show :: PubKeyALG -> String

showList :: [PubKeyALG] -> ShowS

Eq PubKeyALG Source # 
Instance details

Defined in Data.X509.AlgorithmIdentifier

Methods

(==) :: PubKeyALG -> PubKeyALG -> Bool

(/=) :: PubKeyALG -> PubKeyALG -> Bool

data SignatureALG Source #

Signature Algorithm, often composed of a public key algorithm and a hash algorithm. For some signature algorithms the hash algorithm is intrinsic to the public key algorithm and is not needed in the data type.

Instances

Instances details
ASN1Object SignatureALG Source # 
Instance details

Defined in Data.X509.AlgorithmIdentifier

Methods

toASN1 :: SignatureALG -> ASN1S

fromASN1 :: [ASN1] -> Either String (SignatureALG, [ASN1])

Show SignatureALG Source # 
Instance details

Defined in Data.X509.AlgorithmIdentifier

Methods

showsPrec :: Int -> SignatureALG -> ShowS

show :: SignatureALG -> String

showList :: [SignatureALG] -> ShowS

Eq SignatureALG Source # 
Instance details

Defined in Data.X509.AlgorithmIdentifier

Methods

(==) :: SignatureALG -> SignatureALG -> Bool

(/=) :: SignatureALG -> SignatureALG -> Bool

class Extension a where Source #

Extension class.

each extension have a unique OID associated, and a way to encode and decode an ASN1 stream.

Errata: turns out, the content is not necessarily ASN1, it could be data that is only parsable by the extension e.g. raw ascii string. Add method to parse and encode with ByteString

Minimal complete definition

extOID, extHasNestedASN1, extEncode, extDecode

Methods

extOID :: a -> OID Source #

extHasNestedASN1 :: Proxy a -> Bool Source #

extEncode :: a -> [ASN1] Source #

extDecode :: [ASN1] -> Either String a Source #

extDecodeBs :: ByteString -> Either String a Source #

extEncodeBs :: a -> ByteString Source #

Instances

Instances details
Extension ExtAuthorityKeyId Source # 
Instance details

Defined in Data.X509.Ext

Methods

extOID :: ExtAuthorityKeyId -> OID Source #

extHasNestedASN1 :: Proxy ExtAuthorityKeyId -> Bool Source #

extEncode :: ExtAuthorityKeyId -> [ASN1] Source #

extDecode :: [ASN1] -> Either String ExtAuthorityKeyId Source #

extDecodeBs :: ByteString -> Either String ExtAuthorityKeyId Source #

extEncodeBs :: ExtAuthorityKeyId -> ByteString Source #

Extension ExtBasicConstraints Source # 
Instance details

Defined in Data.X509.Ext

Extension ExtCrlDistributionPoints Source # 
Instance details

Defined in Data.X509.Ext

Extension ExtExtendedKeyUsage Source # 
Instance details

Defined in Data.X509.Ext

Extension ExtKeyUsage Source # 
Instance details

Defined in Data.X509.Ext

Methods

extOID :: ExtKeyUsage -> OID Source #

extHasNestedASN1 :: Proxy ExtKeyUsage -> Bool Source #

extEncode :: ExtKeyUsage -> [ASN1] Source #

extDecode :: [ASN1] -> Either String ExtKeyUsage Source #

extDecodeBs :: ByteString -> Either String ExtKeyUsage Source #

extEncodeBs :: ExtKeyUsage -> ByteString Source #

Extension ExtNetscapeComment Source # 
Instance details

Defined in Data.X509.Ext

Extension ExtSubjectAltName Source # 
Instance details

Defined in Data.X509.Ext

Methods

extOID :: ExtSubjectAltName -> OID Source #

extHasNestedASN1 :: Proxy ExtSubjectAltName -> Bool Source #

extEncode :: ExtSubjectAltName -> [ASN1] Source #

extDecode :: [ASN1] -> Either String ExtSubjectAltName Source #

extDecodeBs :: ByteString -> Either String ExtSubjectAltName Source #

extEncodeBs :: ExtSubjectAltName -> ByteString Source #

Extension ExtSubjectKeyId Source # 
Instance details

Defined in Data.X509.Ext

Methods

extOID :: ExtSubjectKeyId -> OID Source #

extHasNestedASN1 :: Proxy ExtSubjectKeyId -> Bool Source #

extEncode :: ExtSubjectKeyId -> [ASN1] Source #

extDecode :: [ASN1] -> Either String ExtSubjectKeyId Source #

extDecodeBs :: ByteString -> Either String ExtSubjectKeyId Source #

extEncodeBs :: ExtSubjectKeyId -> ByteString Source #

data ExtBasicConstraints Source #

Basic Constraints

Constructors

ExtBasicConstraints Bool (Maybe Integer) 

Instances

Instances details
Show ExtBasicConstraints Source # 
Instance details

Defined in Data.X509.Ext

Methods

showsPrec :: Int -> ExtBasicConstraints -> ShowS

show :: ExtBasicConstraints -> String

showList :: [ExtBasicConstraints] -> ShowS

Eq ExtBasicConstraints Source # 
Instance details

Defined in Data.X509.Ext

Extension ExtBasicConstraints Source # 
Instance details

Defined in Data.X509.Ext

data ExtKeyUsage Source #

Describe key usage

Instances

Instances details
Show ExtKeyUsage Source # 
Instance details

Defined in Data.X509.Ext

Methods

showsPrec :: Int -> ExtKeyUsage -> ShowS

show :: ExtKeyUsage -> String

showList :: [ExtKeyUsage] -> ShowS

Eq ExtKeyUsage Source # 
Instance details

Defined in Data.X509.Ext

Methods

(==) :: ExtKeyUsage -> ExtKeyUsage -> Bool

(/=) :: ExtKeyUsage -> ExtKeyUsage -> Bool

Extension ExtKeyUsage Source # 
Instance details

Defined in Data.X509.Ext

Methods

extOID :: ExtKeyUsage -> OID Source #

extHasNestedASN1 :: Proxy ExtKeyUsage -> Bool Source #

extEncode :: ExtKeyUsage -> [ASN1] Source #

extDecode :: [ASN1] -> Either String ExtKeyUsage Source #

extDecodeBs :: ByteString -> Either String ExtKeyUsage Source #

extEncodeBs :: ExtKeyUsage -> ByteString Source #

data ExtKeyUsageFlag Source #

key usage flag that is found in the key usage extension field.

data ExtExtendedKeyUsage Source #

Extended key usage extension

Instances

Instances details
Show ExtExtendedKeyUsage Source # 
Instance details

Defined in Data.X509.Ext

Methods

showsPrec :: Int -> ExtExtendedKeyUsage -> ShowS

show :: ExtExtendedKeyUsage -> String

showList :: [ExtExtendedKeyUsage] -> ShowS

Eq ExtExtendedKeyUsage Source # 
Instance details

Defined in Data.X509.Ext

Extension ExtExtendedKeyUsage Source # 
Instance details

Defined in Data.X509.Ext

data ExtSubjectKeyId Source #

Provide a way to identify a public key by a short hash.

Constructors

ExtSubjectKeyId ByteString 

Instances

Instances details
Show ExtSubjectKeyId Source # 
Instance details

Defined in Data.X509.Ext

Methods

showsPrec :: Int -> ExtSubjectKeyId -> ShowS

show :: ExtSubjectKeyId -> String

showList :: [ExtSubjectKeyId] -> ShowS

Eq ExtSubjectKeyId Source # 
Instance details

Defined in Data.X509.Ext

Extension ExtSubjectKeyId Source # 
Instance details

Defined in Data.X509.Ext

Methods

extOID :: ExtSubjectKeyId -> OID Source #

extHasNestedASN1 :: Proxy ExtSubjectKeyId -> Bool Source #

extEncode :: ExtSubjectKeyId -> [ASN1] Source #

extDecode :: [ASN1] -> Either String ExtSubjectKeyId Source #

extDecodeBs :: ByteString -> Either String ExtSubjectKeyId Source #

extEncodeBs :: ExtSubjectKeyId -> ByteString Source #

data ExtSubjectAltName Source #

Provide a way to supply alternate name that can be used for matching host name.

Constructors

ExtSubjectAltName [AltName] 

data ExtAuthorityKeyId Source #

Provide a mean to identify the public key corresponding to the private key used to signed a certificate.

Constructors

ExtAuthorityKeyId ByteString 

Instances

Instances details
Show ExtAuthorityKeyId Source # 
Instance details

Defined in Data.X509.Ext

Methods

showsPrec :: Int -> ExtAuthorityKeyId -> ShowS

show :: ExtAuthorityKeyId -> String

showList :: [ExtAuthorityKeyId] -> ShowS

Eq ExtAuthorityKeyId Source # 
Instance details

Defined in Data.X509.Ext

Extension ExtAuthorityKeyId Source # 
Instance details

Defined in Data.X509.Ext

Methods

extOID :: ExtAuthorityKeyId -> OID Source #

extHasNestedASN1 :: Proxy ExtAuthorityKeyId -> Bool Source #

extEncode :: ExtAuthorityKeyId -> [ASN1] Source #

extDecode :: [ASN1] -> Either String ExtAuthorityKeyId Source #

extDecodeBs :: ByteString -> Either String ExtAuthorityKeyId Source #

extEncodeBs :: ExtAuthorityKeyId -> ByteString Source #

data ExtNetscapeComment Source #

Constructors

ExtNetscapeComment ByteString 

Instances

Instances details
Show ExtNetscapeComment Source # 
Instance details

Defined in Data.X509.Ext

Methods

showsPrec :: Int -> ExtNetscapeComment -> ShowS

show :: ExtNetscapeComment -> String

showList :: [ExtNetscapeComment] -> ShowS

Eq ExtNetscapeComment Source # 
Instance details

Defined in Data.X509.Ext

Extension ExtNetscapeComment Source # 
Instance details

Defined in Data.X509.Ext

data AltName Source #

Different naming scheme use by the extension.

Not all name types are available, missing: otherName x400Address directoryName ediPartyName registeredID

Constructors

AltNameRFC822 String 
AltNameDNS String 
AltNameURI String 
AltNameIP ByteString 
AltNameXMPP String 
AltNameDNSSRV String 

Instances

Instances details
Show AltName Source # 
Instance details

Defined in Data.X509.Ext

Methods

showsPrec :: Int -> AltName -> ShowS

show :: AltName -> String

showList :: [AltName] -> ShowS

Eq AltName Source # 
Instance details

Defined in Data.X509.Ext

Methods

(==) :: AltName -> AltName -> Bool

(/=) :: AltName -> AltName -> Bool

Ord AltName Source # 
Instance details

Defined in Data.X509.Ext

Methods

compare :: AltName -> AltName -> Ordering

(<) :: AltName -> AltName -> Bool

(<=) :: AltName -> AltName -> Bool

(>) :: AltName -> AltName -> Bool

(>=) :: AltName -> AltName -> Bool

max :: AltName -> AltName -> AltName

min :: AltName -> AltName -> AltName

data DistributionPoint Source #

Distribution point as either some GeneralNames or a DN

Instances

Instances details
Show DistributionPoint Source # 
Instance details

Defined in Data.X509.Ext

Methods

showsPrec :: Int -> DistributionPoint -> ShowS

show :: DistributionPoint -> String

showList :: [DistributionPoint] -> ShowS

Eq DistributionPoint Source # 
Instance details

Defined in Data.X509.Ext

extensionGet :: Extension a => Extensions -> Maybe a Source #

Get a specific extension from a lists of raw extensions

extensionGetE :: Extension a => Extensions -> Maybe (Either String a) Source #

Get a specific extension from a lists of raw extensions

extensionDecode :: Extension a => ExtensionRaw -> Maybe (Either String a) Source #

Try to decode an ExtensionRaw.

If this function return: * Nothing, the OID doesn't match * Just Left, the OID matched, but the extension couldn't be decoded * Just Right, the OID matched, and the extension has been succesfully decoded

extensionEncode :: Extension a => Bool -> a -> ExtensionRaw Source #

Encode an Extension to extensionRaw

data ExtensionRaw Source #

An undecoded extension

Constructors

ExtensionRaw 

Fields

Instances

Instances details
ASN1Object ExtensionRaw Source # 
Instance details

Defined in Data.X509.ExtensionRaw

Methods

toASN1 :: ExtensionRaw -> ASN1S

fromASN1 :: [ASN1] -> Either String (ExtensionRaw, [ASN1])

Show ExtensionRaw Source # 
Instance details

Defined in Data.X509.ExtensionRaw

Methods

showsPrec :: Int -> ExtensionRaw -> ShowS

show :: ExtensionRaw -> String

showList :: [ExtensionRaw] -> ShowS

Eq ExtensionRaw Source # 
Instance details

Defined in Data.X509.ExtensionRaw

Methods

(==) :: ExtensionRaw -> ExtensionRaw -> Bool

(/=) :: ExtensionRaw -> ExtensionRaw -> Bool

tryExtRawASN1 :: ExtensionRaw -> Either String [ASN1] Source #

extRawASN1 :: ExtensionRaw -> [ASN1] Source #

Deprecated: use tryExtRawASN1 instead

newtype Extensions Source #

a Set of ExtensionRaw

Constructors

Extensions (Maybe [ExtensionRaw]) 

Instances

Instances details
ASN1Object Extensions Source # 
Instance details

Defined in Data.X509.ExtensionRaw

Methods

toASN1 :: Extensions -> ASN1S

fromASN1 :: [ASN1] -> Either String (Extensions, [ASN1])

Show Extensions Source # 
Instance details

Defined in Data.X509.ExtensionRaw

Methods

showsPrec :: Int -> Extensions -> ShowS

show :: Extensions -> String

showList :: [Extensions] -> ShowS

Eq Extensions Source # 
Instance details

Defined in Data.X509.ExtensionRaw

Methods

(==) :: Extensions -> Extensions -> Bool

(/=) :: Extensions -> Extensions -> Bool

Certificate Revocation List (CRL)

data CRL Source #

Describe a Certificate revocation list

Instances

Instances details
ASN1Object CRL Source # 
Instance details

Defined in Data.X509.CRL

Methods

toASN1 :: CRL -> ASN1S

fromASN1 :: [ASN1] -> Either String (CRL, [ASN1])

Show CRL Source # 
Instance details

Defined in Data.X509.CRL

Methods

showsPrec :: Int -> CRL -> ShowS

show :: CRL -> String

showList :: [CRL] -> ShowS

Eq CRL Source # 
Instance details

Defined in Data.X509.CRL

Methods

(==) :: CRL -> CRL -> Bool

(/=) :: CRL -> CRL -> Bool

data RevokedCertificate Source #

Describe a revoked certificate identifiable by serial number.

Constructors

RevokedCertificate 

Fields

Instances

Instances details
ASN1Object RevokedCertificate Source # 
Instance details

Defined in Data.X509.CRL

Methods

toASN1 :: RevokedCertificate -> ASN1S

fromASN1 :: [ASN1] -> Either String (RevokedCertificate, [ASN1])

Show RevokedCertificate Source # 
Instance details

Defined in Data.X509.CRL

Methods

showsPrec :: Int -> RevokedCertificate -> ShowS

show :: RevokedCertificate -> String

showList :: [RevokedCertificate] -> ShowS

Eq RevokedCertificate Source # 
Instance details

Defined in Data.X509.CRL

Naming

newtype DistinguishedName Source #

A list of OID and strings.

Instances

Instances details
ASN1Object DistinguishedName Source # 
Instance details

Defined in Data.X509.DistinguishedName

Methods

toASN1 :: DistinguishedName -> ASN1S

fromASN1 :: [ASN1] -> Either String (DistinguishedName, [ASN1])

Monoid DistinguishedName Source # 
Instance details

Defined in Data.X509.DistinguishedName

Semigroup DistinguishedName Source # 
Instance details

Defined in Data.X509.DistinguishedName

Show DistinguishedName Source # 
Instance details

Defined in Data.X509.DistinguishedName

Methods

showsPrec :: Int -> DistinguishedName -> ShowS

show :: DistinguishedName -> String

showList :: [DistinguishedName] -> ShowS

Eq DistinguishedName Source # 
Instance details

Defined in Data.X509.DistinguishedName

Ord DistinguishedName Source # 
Instance details

Defined in Data.X509.DistinguishedName

data DnElement Source #

Elements commonly available in a DistinguishedName structure

Constructors

DnCommonName

CN

DnCountry

Country

DnOrganization

O

DnOrganizationUnit

OU

DnEmailAddress

Email Address (legacy)

Instances

Instances details
OIDable DnElement Source # 
Instance details

Defined in Data.X509.DistinguishedName

Methods

getObjectID :: DnElement -> OID

Show DnElement Source # 
Instance details

Defined in Data.X509.DistinguishedName

Methods

showsPrec :: Int -> DnElement -> ShowS

show :: DnElement -> String

showList :: [DnElement] -> ShowS

Eq DnElement Source # 
Instance details

Defined in Data.X509.DistinguishedName

Methods

(==) :: DnElement -> DnElement -> Bool

(/=) :: DnElement -> DnElement -> Bool

getDnElement :: DnElement -> DistinguishedName -> Maybe ASN1CharacterString Source #

Try to get a specific element in a DistinguishedName structure

Certificate Chain

newtype CertificateChain Source #

A chain of X.509 certificates in exact form.

Instances

Instances details
Show CertificateChain Source # 
Instance details

Defined in Data.X509.CertificateChain

Methods

showsPrec :: Int -> CertificateChain -> ShowS

show :: CertificateChain -> String

showList :: [CertificateChain] -> ShowS

Eq CertificateChain Source # 
Instance details

Defined in Data.X509.CertificateChain

newtype CertificateChainRaw Source #

Represent a chain of X.509 certificates in bytestring form.

Constructors

CertificateChainRaw [ByteString] 

Instances

Instances details
Show CertificateChainRaw Source # 
Instance details

Defined in Data.X509.CertificateChain

Methods

showsPrec :: Int -> CertificateChainRaw -> ShowS

show :: CertificateChainRaw -> String

showList :: [CertificateChainRaw] -> ShowS

Eq CertificateChainRaw Source # 
Instance details

Defined in Data.X509.CertificateChain

decodeCertificateChain :: CertificateChainRaw -> Either (Int, String) CertificateChain Source #

Decode a CertificateChainRaw into a CertificateChain if every raw certificate are decoded correctly, otherwise return the index of the failed certificate and the error associated.

encodeCertificateChain :: CertificateChain -> CertificateChainRaw Source #

Convert a CertificateChain into a CertificateChainRaw

Signed types and marshalling

data (Show a, Eq a, ASN1Object a) => Signed a Source #

Represent a signed object using a traditional X509 structure.

When dealing with external certificate, use the SignedExact structure not this one.

Constructors

Signed 

Fields

Instances

Instances details
(Eq a, ASN1Object a, Show a) => Show (Signed a) Source # 
Instance details

Defined in Data.X509.Signed

Methods

showsPrec :: Int -> Signed a -> ShowS

show :: Signed a -> String

showList :: [Signed a] -> ShowS

(Show a, ASN1Object a, Eq a) => Eq (Signed a) Source # 
Instance details

Defined in Data.X509.Signed

Methods

(==) :: Signed a -> Signed a -> Bool

(/=) :: Signed a -> Signed a -> Bool

data (Show a, Eq a, ASN1Object a) => SignedExact a Source #

Represent the signed object plus the raw data that we need to keep around for non compliant case to be able to verify signature.

Instances

Instances details
(Show a, Eq a, ASN1Object a) => Show (SignedExact a) Source # 
Instance details

Defined in Data.X509.Signed

Methods

showsPrec :: Int -> SignedExact a -> ShowS

show :: SignedExact a -> String

showList :: [SignedExact a] -> ShowS

(Show a, Eq a, ASN1Object a) => Eq (SignedExact a) Source # 
Instance details

Defined in Data.X509.Signed

Methods

(==) :: SignedExact a -> SignedExact a -> Bool

(/=) :: SignedExact a -> SignedExact a -> Bool

getSigned :: SignedExact a -> Signed a Source #

get the decoded Signed data

getSignedData :: (Show a, Eq a, ASN1Object a) => SignedExact a -> ByteString Source #

Get the signed data for the signature

objectToSignedExact Source #

Arguments

:: (Show a, Eq a, ASN1Object a) 
=> (ByteString -> (ByteString, SignatureALG, r))

signature function

-> a

object to sign

-> (SignedExact a, r) 

Transform an object into a SignedExact object

objectToSignedExactF Source #

Arguments

:: (Functor f, Show a, Eq a, ASN1Object a) 
=> (ByteString -> f (ByteString, SignatureALG))

signature function

-> a

object to sign

-> f (SignedExact a) 

A generalization of objectToSignedExact where the signature function runs in an arbitrary functor. This allows for example to sign using an algorithm needing random values.

encodeSignedObject :: SignedExact a -> ByteString Source #

The raw representation of the whole signed structure

decodeSignedObject :: (Show a, Eq a, ASN1Object a) => ByteString -> Either String (SignedExact a) Source #

Try to parse a bytestring that use the typical X509 signed structure format

Parametrized Signed accessor

getCertificate :: SignedCertificate -> Certificate Source #

Get the Certificate associated to a SignedCertificate

getCRL :: SignedCRL -> CRL Source #

Get the CRL associated to a SignedCRL

decodeSignedCertificate :: ByteString -> Either String SignedCertificate Source #

Try to decode a bytestring to a SignedCertificate

decodeSignedCRL :: ByteString -> Either String SignedCRL Source #

Try to decode a bytestring to a SignedCRL

Hash distinguished names related function

hashDN :: DistinguishedName -> ByteString Source #

Make an OpenSSL style hash of distinguished name

OpenSSL algorithm is odd, and has been replicated here somewhat. only lower the case of ascii character.

hashDN_old :: DistinguishedName -> ByteString Source #

Create an openssl style old hash of distinguished name