x509-1.7.5: X509 reader and writer

License | BSD-style
Maintainer | Vincent Hanquez <vincent@snarc.org>
Stability | experimental
Portability | unknown
Safe Haskell | None
Language | Haskell2010

Data.X509

Contents

- Types
- Common extension usually found in x509v3
- Accessor turning extension into a specific one
- Certificate Revocation List (CRL)
- Naming
- Certificate Chain
- marshall between CertificateChain and CertificateChainRaw
- Signed types and marshalling
- Parametrized Signed accessor
- Hash distinguished names related function

Description

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

Follows RFC5280 / RFC6818

Synopsis

- type SignedCertificate = SignedExact Certificate
- type SignedCRL = SignedExact CRL
- data Certificate = Certificate {
  - certVersion :: Int
  - certSerial :: Integer
  - certSignatureAlg :: SignatureALG
  - certIssuerDN :: DistinguishedName
  - certValidity :: (DateTime, DateTime)
  - certSubjectDN :: DistinguishedName
  - certPubKey :: PubKey
  - certExtensions :: Extensions
  }
- data PubKey
  - = PubKeyRSA PublicKey
  - | PubKeyDSA PublicKey
  - | PubKeyDH (Integer, Integer, Integer, Maybe Integer, ([Word8], Integer))
  - | PubKeyEC PubKeyEC
  - | PubKeyX25519 PublicKey
  - | PubKeyX448 PublicKey
  - | PubKeyEd25519 PublicKey
  - | PubKeyEd448 PublicKey
  - | PubKeyUnknown OID ByteString
- data PubKeyEC
  - = PubKeyEC_Prime {
    - pubkeyEC_pub :: SerializedPoint
    - pubkeyEC_a :: Integer
    - pubkeyEC_b :: Integer
    - pubkeyEC_prime :: Integer
    - pubkeyEC_generator :: SerializedPoint
    - pubkeyEC_order :: Integer
    - pubkeyEC_cofactor :: Integer
    - pubkeyEC_seed :: Integer
    }
  - | PubKeyEC_Named {
    - pubkeyEC_name :: CurveName
    - pubkeyEC_pub :: SerializedPoint
    }
- newtype SerializedPoint = SerializedPoint ByteString
- data PrivKey
  - = PrivKeyRSA PrivateKey
  - | PrivKeyDSA PrivateKey
  - | PrivKeyEC PrivKeyEC
  - | PrivKeyX25519 SecretKey
  - | PrivKeyX448 SecretKey
  - | PrivKeyEd25519 SecretKey
  - | PrivKeyEd448 SecretKey
- data PrivKeyEC
  - = PrivKeyEC_Prime {
    - privkeyEC_priv :: Integer
    - privkeyEC_a :: Integer
    - privkeyEC_b :: Integer
    - privkeyEC_prime :: Integer
    - privkeyEC_generator :: SerializedPoint
    - privkeyEC_order :: Integer
    - privkeyEC_cofactor :: Integer
    - privkeyEC_seed :: Integer
    }
  - | PrivKeyEC_Named {
    - privkeyEC_name :: CurveName
    - privkeyEC_priv :: Integer
    }
- pubkeyToAlg :: PubKey -> PubKeyALG
- privkeyToAlg :: PrivKey -> PubKeyALG
- data HashALG
  - = HashMD2
  - | HashMD5
  - | HashSHA1
  - | HashSHA224
  - | HashSHA256
  - | HashSHA384
  - | HashSHA512
- data PubKeyALG
  - = PubKeyALG_RSA
  - | PubKeyALG_RSAPSS
  - | PubKeyALG_DSA
  - | PubKeyALG_EC
  - | PubKeyALG_X25519
  - | PubKeyALG_X448
  - | PubKeyALG_Ed25519
  - | PubKeyALG_Ed448
  - | PubKeyALG_DH
  - | PubKeyALG_Unknown OID
- data SignatureALG
  - = SignatureALG HashALG PubKeyALG
  - | SignatureALG_IntrinsicHash PubKeyALG
  - | SignatureALG_Unknown OID
- class Extension a where
  - extOID :: a -> OID
  - extHasNestedASN1 :: Proxy a -> Bool
  - extEncode :: a -> [ASN1]
  - extDecode :: [ASN1] -> Either String a
  - extDecodeBs :: ByteString -> Either String a
  - extEncodeBs :: a -> ByteString
- data ExtBasicConstraints = ExtBasicConstraints Bool (Maybe Integer)
- data ExtKeyUsage = ExtKeyUsage [ExtKeyUsageFlag]
- data ExtKeyUsageFlag
  - = KeyUsage_digitalSignature
  - | KeyUsage_nonRepudiation
  - | KeyUsage_keyEncipherment
  - | KeyUsage_dataEncipherment
  - | KeyUsage_keyAgreement
  - | KeyUsage_keyCertSign
  - | KeyUsage_cRLSign
  - | KeyUsage_encipherOnly
  - | KeyUsage_decipherOnly
- data ExtExtendedKeyUsage = ExtExtendedKeyUsage [ExtKeyUsagePurpose]
- data ExtKeyUsagePurpose
  - = KeyUsagePurpose_ServerAuth
  - | KeyUsagePurpose_ClientAuth
  - | KeyUsagePurpose_CodeSigning
  - | KeyUsagePurpose_EmailProtection
  - | KeyUsagePurpose_TimeStamping
  - | KeyUsagePurpose_OCSPSigning
  - | KeyUsagePurpose_Unknown OID
- data ExtSubjectKeyId = ExtSubjectKeyId ByteString
- data ExtSubjectAltName = ExtSubjectAltName [AltName]
- data ExtAuthorityKeyId = ExtAuthorityKeyId ByteString
- data ExtCrlDistributionPoints = ExtCrlDistributionPoints [DistributionPoint]
- data ExtNetscapeComment = ExtNetscapeComment ByteString
- data AltName
  - = AltNameRFC822 String
  - | AltNameDNS String
  - | AltNameURI String
  - | AltNameIP ByteString
  - | AltNameXMPP String
  - | AltNameDNSSRV String
- data DistributionPoint
  - = DistributionPointFullName [AltName]
  - | DistributionNameRelative DistinguishedName
- data ReasonFlag
  - = Reason_Unused
  - | Reason_KeyCompromise
  - | Reason_CACompromise
  - | Reason_AffiliationChanged
  - | Reason_Superseded
  - | Reason_CessationOfOperation
  - | Reason_CertificateHold
  - | Reason_PrivilegeWithdrawn
  - | Reason_AACompromise
- extensionGet :: Extension a => Extensions -> Maybe a
- extensionGetE :: Extension a => Extensions -> Maybe (Either String a)
- extensionDecode :: forall a. Extension a => ExtensionRaw -> Maybe (Either String a)
- extensionEncode :: forall a. Extension a => Bool -> a -> ExtensionRaw
- data ExtensionRaw = ExtensionRaw {
  - extRawOID :: OID
  - extRawCritical :: Bool
  - extRawContent :: ByteString
  }
- tryExtRawASN1 :: ExtensionRaw -> Either String [ASN1]
- extRawASN1 :: ExtensionRaw -> [ASN1]
- newtype Extensions = Extensions (Maybe [ExtensionRaw])
- data CRL = CRL {
  - crlVersion :: Integer
  - crlSignatureAlg :: SignatureALG
  - crlIssuer :: DistinguishedName
  - crlThisUpdate :: DateTime
  - crlNextUpdate :: Maybe DateTime
  - crlRevokedCertificates :: [RevokedCertificate]
  - crlExtensions :: Extensions
  }
- data RevokedCertificate = RevokedCertificate {
  - revokedSerialNumber :: Integer
  - revokedDate :: DateTime
  - revokedExtensions :: Extensions
  }
- newtype DistinguishedName = DistinguishedName {
  - getDistinguishedElements :: [(OID, ASN1CharacterString)]
  }
- data DnElement
  - = DnCommonName
  - | DnCountry
  - | DnOrganization
  - | DnOrganizationUnit
  - | DnEmailAddress
- data ASN1CharacterString = ASN1CharacterString {
  - characterEncoding :: ASN1StringEncoding
  - getCharacterStringRawData :: ByteString
  }
- getDnElement :: DnElement -> DistinguishedName -> Maybe ASN1CharacterString
- newtype CertificateChain = CertificateChain [SignedExact Certificate]
- newtype CertificateChainRaw = CertificateChainRaw [ByteString]
- decodeCertificateChain :: CertificateChainRaw -> Either (Int, String) CertificateChain
- encodeCertificateChain :: CertificateChain -> CertificateChainRaw
- data (Show a, Eq a, ASN1Object a) => Signed a = Signed {
  - signedObject :: a
  - signedAlg :: SignatureALG
  - signedSignature :: ByteString
  }
- data (Show a, Eq a, ASN1Object a) => SignedExact a
- getSigned :: SignedExact a -> Signed a
- getSignedData :: (Show a, Eq a, ASN1Object a) => SignedExact a -> ByteString
- objectToSignedExact :: (Show a, Eq a, ASN1Object a) => (ByteString -> (ByteString, SignatureALG, r)) -> a -> (SignedExact a, r)
- objectToSignedExactF :: (Functor f, Show a, Eq a, ASN1Object a) => (ByteString -> f (ByteString, SignatureALG)) -> a -> f (SignedExact a)
- encodeSignedObject :: SignedExact a -> ByteString
- decodeSignedObject :: (Show a, Eq a, ASN1Object a) => ByteString -> Either String (SignedExact a)
- getCertificate :: SignedCertificate -> Certificate
- getCRL :: SignedCRL -> CRL
- decodeSignedCertificate :: ByteString -> Either String SignedCertificate
- decodeSignedCRL :: ByteString -> Either String SignedCRL
- hashDN :: DistinguishedName -> ByteString
- hashDN_old :: DistinguishedName -> ByteString

# Types

type SignedCertificate = SignedExact Certificate #

A Signed Certificate

type SignedCRL = SignedExact CRL #

A Signed CRL

data Certificate #

X.509 Certificate type.

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

Constructors

Certificate |
Fields certVersion :: Int Version certSerial :: Integer Serial number certSignatureAlg :: SignatureALG Signature algorithm certIssuerDN :: DistinguishedName Issuer DN certValidity :: (DateTime, DateTime) Validity period (UTC) certSubjectDN :: DistinguishedName Subject DN certPubKey :: PubKey Public key certExtensions :: Extensions Extensions

#### Instances

Instances details

Eq Certificate # |
Instance details Defined in Data.X509.Cert Methods (==) :: Certificate -> Certificate -> Bool # (/=) :: Certificate -> Certificate -> Bool #
Show Certificate # |
Instance details Defined in Data.X509.Cert Methods showsPrec :: Int -> Certificate -> ShowS # show :: Certificate -> String # showList :: [Certificate] -> ShowS #
ASN1Object Certificate # |
Instance details Defined in Data.X509.Cert Methods toASN1 :: Certificate -> ASN1S # fromASN1 :: [ASN1] -> Either String (Certificate, [ASN1]) #

data PubKey #

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

Eq PubKey # |
Instance details Defined in Data.X509.PublicKey Methods (==) :: PubKey -> PubKey -> Bool # (/=) :: PubKey -> PubKey -> Bool #
Show PubKey # |
Instance details Defined in Data.X509.PublicKey Methods showsPrec :: Int -> PubKey -> ShowS # show :: PubKey -> String # showList :: [PubKey] -> ShowS #
ASN1Object PubKey # |
Instance details Defined in Data.X509.PublicKey Methods toASN1 :: PubKey -> ASN1S # fromASN1 :: [ASN1] -> Either String (PubKey, [ASN1]) #

data PubKeyEC #

Elliptic Curve Public Key

TODO: missing support for binary curve.

Constructors

PubKeyEC_Prime |
Fields pubkeyEC_pub :: SerializedPoint pubkeyEC_a :: Integer pubkeyEC_b :: Integer pubkeyEC_prime :: Integer pubkeyEC_generator :: SerializedPoint pubkeyEC_order :: Integer pubkeyEC_cofactor :: Integer pubkeyEC_seed :: Integer
PubKeyEC_Named |
Fields pubkeyEC_name :: CurveName pubkeyEC_pub :: SerializedPoint

#### Instances

Instances details

Eq PubKeyEC # |
Instance details Defined in Data.X509.PublicKey Methods (==) :: PubKeyEC -> PubKeyEC -> Bool # (/=) :: PubKeyEC -> PubKeyEC -> Bool #
Show PubKeyEC # |
Instance details Defined in Data.X509.PublicKey Methods showsPrec :: Int -> PubKeyEC -> ShowS # show :: PubKeyEC -> String # showList :: [PubKeyEC] -> ShowS #

newtype SerializedPoint #

Serialized Elliptic Curve Point

Constructors

SerializedPoint ByteString |

#### Instances

Instances details

Eq SerializedPoint # |
Instance details Defined in Data.X509.PublicKey Methods (==) :: SerializedPoint -> SerializedPoint -> Bool # (/=) :: SerializedPoint -> SerializedPoint -> Bool #
Show SerializedPoint # |
Instance details Defined in Data.X509.PublicKey Methods showsPrec :: Int -> SerializedPoint -> ShowS # show :: SerializedPoint -> String # showList :: [SerializedPoint] -> ShowS #

data PrivKey #

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

Eq PrivKey # |
Instance details Defined in Data.X509.PrivateKey Methods (==) :: PrivKey -> PrivKey -> Bool # (/=) :: PrivKey -> PrivKey -> Bool #
Show PrivKey # |
Instance details Defined in Data.X509.PrivateKey Methods showsPrec :: Int -> PrivKey -> ShowS # show :: PrivKey -> String # showList :: [PrivKey] -> ShowS #
ASN1Object PrivKey # |
Instance details Defined in Data.X509.PrivateKey Methods toASN1 :: PrivKey -> ASN1S # fromASN1 :: [ASN1] -> Either String (PrivKey, [ASN1]) #

data PrivKeyEC #

Elliptic Curve Private Key

TODO: missing support for binary curve.

Constructors

PrivKeyEC_Prime |
Fields privkeyEC_priv :: Integer privkeyEC_a :: Integer privkeyEC_b :: Integer privkeyEC_prime :: Integer privkeyEC_generator :: SerializedPoint privkeyEC_order :: Integer privkeyEC_cofactor :: Integer privkeyEC_seed :: Integer
PrivKeyEC_Named |
Fields privkeyEC_name :: CurveName privkeyEC_priv :: Integer

#### Instances

Instances details

Eq PrivKeyEC # |
Instance details Defined in Data.X509.PrivateKey Methods (==) :: PrivKeyEC -> PrivKeyEC -> Bool # (/=) :: PrivKeyEC -> PrivKeyEC -> Bool #
Show PrivKeyEC # |
Instance details Defined in Data.X509.PrivateKey Methods showsPrec :: Int -> PrivKeyEC -> ShowS # show :: PrivKeyEC -> String # showList :: [PrivKeyEC] -> ShowS #

pubkeyToAlg :: PubKey -> PubKeyALG #

Convert a Public key to the Public Key Algorithm type

privkeyToAlg :: PrivKey -> PubKeyALG #

Convert a Private key to the Public Key Algorithm type

data HashALG #

Hash Algorithm

Constructors

HashMD2 |
HashMD5 |
HashSHA1 |
HashSHA224 |
HashSHA256 |
HashSHA384 |
HashSHA512 |

#### Instances

Instances details

Eq HashALG # |
Instance details Defined in Data.X509.AlgorithmIdentifier Methods (==) :: HashALG -> HashALG -> Bool # (/=) :: HashALG -> HashALG -> Bool #
Show HashALG # |
Instance details Defined in Data.X509.AlgorithmIdentifier Methods showsPrec :: Int -> HashALG -> ShowS # show :: HashALG -> String # showList :: [HashALG] -> ShowS #

data PubKeyALG #

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

Eq PubKeyALG # |
Instance details Defined in Data.X509.AlgorithmIdentifier Methods (==) :: PubKeyALG -> PubKeyALG -> Bool # (/=) :: PubKeyALG -> PubKeyALG -> Bool #
Show PubKeyALG # |
Instance details Defined in Data.X509.AlgorithmIdentifier Methods showsPrec :: Int -> PubKeyALG -> ShowS # show :: PubKeyALG -> String # showList :: [PubKeyALG] -> ShowS #
OIDable PubKeyALG # |
Instance details Defined in Data.X509.AlgorithmIdentifier Methods getObjectID :: PubKeyALG -> OID #

data SignatureALG #

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.

Constructors

SignatureALG HashALG PubKeyALG |
SignatureALG_IntrinsicHash PubKeyALG |
SignatureALG_Unknown OID |

#### Instances

Instances details

Eq SignatureALG # |
Instance details Defined in Data.X509.AlgorithmIdentifier Methods (==) :: SignatureALG -> SignatureALG -> Bool # (/=) :: SignatureALG -> SignatureALG -> Bool #
Show SignatureALG # |
Instance details Defined in Data.X509.AlgorithmIdentifier Methods showsPrec :: Int -> SignatureALG -> ShowS # show :: SignatureALG -> String # showList :: [SignatureALG] -> ShowS #
ASN1Object SignatureALG # |
Instance details Defined in Data.X509.AlgorithmIdentifier Methods toASN1 :: SignatureALG -> ASN1S # fromASN1 :: [ASN1] -> Either String (SignatureALG, [ASN1]) #

class Extension a where #

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 #

extHasNestedASN1 :: Proxy a -> Bool #

extEncode :: a -> [ASN1] #

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

extDecodeBs :: ByteString -> Either String a #

extEncodeBs :: a -> ByteString #

#### Instances

Instances details

Extension ExtNetscapeComment # |
Instance details Defined in Data.X509.Ext Methods extOID :: ExtNetscapeComment -> OID # extHasNestedASN1 :: Proxy ExtNetscapeComment -> Bool # extEncode :: ExtNetscapeComment -> [ASN1] # extDecode :: [ASN1] -> Either String ExtNetscapeComment # extDecodeBs :: ByteString -> Either String ExtNetscapeComment # extEncodeBs :: ExtNetscapeComment -> ByteString #
Extension ExtCrlDistributionPoints # |
Instance details Defined in Data.X509.Ext Methods extOID :: ExtCrlDistributionPoints -> OID # extHasNestedASN1 :: Proxy ExtCrlDistributionPoints -> Bool # extEncode :: ExtCrlDistributionPoints -> [ASN1] # extDecode :: [ASN1] -> Either String ExtCrlDistributionPoints # extDecodeBs :: ByteString -> Either String ExtCrlDistributionPoints # extEncodeBs :: ExtCrlDistributionPoints -> ByteString #
Extension ExtAuthorityKeyId # |
Instance details Defined in Data.X509.Ext Methods extOID :: ExtAuthorityKeyId -> OID # extHasNestedASN1 :: Proxy ExtAuthorityKeyId -> Bool # extEncode :: ExtAuthorityKeyId -> [ASN1] # extDecode :: [ASN1] -> Either String ExtAuthorityKeyId # extDecodeBs :: ByteString -> Either String ExtAuthorityKeyId # extEncodeBs :: ExtAuthorityKeyId -> ByteString #
Extension ExtSubjectAltName # |
Instance details Defined in Data.X509.Ext Methods extOID :: ExtSubjectAltName -> OID # extHasNestedASN1 :: Proxy ExtSubjectAltName -> Bool # extEncode :: ExtSubjectAltName -> [ASN1] # extDecode :: [ASN1] -> Either String ExtSubjectAltName # extDecodeBs :: ByteString -> Either String ExtSubjectAltName # extEncodeBs :: ExtSubjectAltName -> ByteString #
Extension ExtSubjectKeyId # |
Instance details Defined in Data.X509.Ext Methods extOID :: ExtSubjectKeyId -> OID # extHasNestedASN1 :: Proxy ExtSubjectKeyId -> Bool # extEncode :: ExtSubjectKeyId -> [ASN1] # extDecode :: [ASN1] -> Either String ExtSubjectKeyId # extDecodeBs :: ByteString -> Either String ExtSubjectKeyId # extEncodeBs :: ExtSubjectKeyId -> ByteString #
Extension ExtExtendedKeyUsage # |
Instance details Defined in Data.X509.Ext Methods extOID :: ExtExtendedKeyUsage -> OID # extHasNestedASN1 :: Proxy ExtExtendedKeyUsage -> Bool # extEncode :: ExtExtendedKeyUsage -> [ASN1] # extDecode :: [ASN1] -> Either String ExtExtendedKeyUsage # extDecodeBs :: ByteString -> Either String ExtExtendedKeyUsage # extEncodeBs :: ExtExtendedKeyUsage -> ByteString #
Extension ExtKeyUsage # |
Instance details Defined in Data.X509.Ext Methods extOID :: ExtKeyUsage -> OID # extHasNestedASN1 :: Proxy ExtKeyUsage -> Bool # extEncode :: ExtKeyUsage -> [ASN1] # extDecode :: [ASN1] -> Either String ExtKeyUsage # extDecodeBs :: ByteString -> Either String ExtKeyUsage # extEncodeBs :: ExtKeyUsage -> ByteString #
Extension ExtBasicConstraints # |
Instance details Defined in Data.X509.Ext Methods extOID :: ExtBasicConstraints -> OID # extHasNestedASN1 :: Proxy ExtBasicConstraints -> Bool # extEncode :: ExtBasicConstraints -> [ASN1] # extDecode :: [ASN1] -> Either String ExtBasicConstraints # extDecodeBs :: ByteString -> Either String ExtBasicConstraints # extEncodeBs :: ExtBasicConstraints -> ByteString #

# Common extension usually found in x509v3

data ExtBasicConstraints #

Basic Constraints

Constructors

ExtBasicConstraints Bool (Maybe Integer) |

#### Instances

Instances details

Eq ExtBasicConstraints # |
Instance details Defined in Data.X509.Ext Methods (==) :: ExtBasicConstraints -> ExtBasicConstraints -> Bool # (/=) :: ExtBasicConstraints -> ExtBasicConstraints -> Bool #
Show ExtBasicConstraints # |
Instance details Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtBasicConstraints -> ShowS # show :: ExtBasicConstraints -> String # showList :: [ExtBasicConstraints] -> ShowS #
Extension ExtBasicConstraints # |
Instance details Defined in Data.X509.Ext Methods extOID :: ExtBasicConstraints -> OID # extHasNestedASN1 :: Proxy ExtBasicConstraints -> Bool # extEncode :: ExtBasicConstraints -> [ASN1] # extDecode :: [ASN1] -> Either String ExtBasicConstraints # extDecodeBs :: ByteString -> Either String ExtBasicConstraints # extEncodeBs :: ExtBasicConstraints -> ByteString #

data ExtKeyUsage #

Describe key usage

Constructors

ExtKeyUsage [ExtKeyUsageFlag] |

#### Instances

Instances details

Eq ExtKeyUsage # |
Instance details Defined in Data.X509.Ext Methods (==) :: ExtKeyUsage -> ExtKeyUsage -> Bool # (/=) :: ExtKeyUsage -> ExtKeyUsage -> Bool #
Show ExtKeyUsage # |
Instance details Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtKeyUsage -> ShowS # show :: ExtKeyUsage -> String # showList :: [ExtKeyUsage] -> ShowS #
Extension ExtKeyUsage # |
Instance details Defined in Data.X509.Ext Methods extOID :: ExtKeyUsage -> OID # extHasNestedASN1 :: Proxy ExtKeyUsage -> Bool # extEncode :: ExtKeyUsage -> [ASN1] # extDecode :: [ASN1] -> Either String ExtKeyUsage # extDecodeBs :: ByteString -> Either String ExtKeyUsage # extEncodeBs :: ExtKeyUsage -> ByteString #

data ExtKeyUsageFlag #

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

Constructors

KeyUsage_digitalSignature |
KeyUsage_nonRepudiation |
KeyUsage_keyEncipherment |
KeyUsage_dataEncipherment |
KeyUsage_keyAgreement |
KeyUsage_keyCertSign |
KeyUsage_cRLSign |
KeyUsage_encipherOnly |
KeyUsage_decipherOnly |

#### Instances

Instances details

Enum ExtKeyUsageFlag # |
Instance details Defined in Data.X509.Ext Methods succ :: ExtKeyUsageFlag -> ExtKeyUsageFlag # pred :: ExtKeyUsageFlag -> ExtKeyUsageFlag # toEnum :: Int -> ExtKeyUsageFlag # fromEnum :: ExtKeyUsageFlag -> Int # enumFrom :: ExtKeyUsageFlag -> [ExtKeyUsageFlag] # enumFromThen :: ExtKeyUsageFlag -> ExtKeyUsageFlag -> [ExtKeyUsageFlag] # enumFromTo :: ExtKeyUsageFlag -> ExtKeyUsageFlag -> [ExtKeyUsageFlag] # enumFromThenTo :: ExtKeyUsageFlag -> ExtKeyUsageFlag -> ExtKeyUsageFlag -> [ExtKeyUsageFlag] #
Eq ExtKeyUsageFlag # |
Instance details Defined in Data.X509.Ext Methods (==) :: ExtKeyUsageFlag -> ExtKeyUsageFlag -> Bool # (/=) :: ExtKeyUsageFlag -> ExtKeyUsageFlag -> Bool #
Ord ExtKeyUsageFlag # |
Instance details Defined in Data.X509.Ext Methods compare :: ExtKeyUsageFlag -> ExtKeyUsageFlag -> Ordering # (<) :: ExtKeyUsageFlag -> ExtKeyUsageFlag -> Bool # (<=) :: ExtKeyUsageFlag -> ExtKeyUsageFlag -> Bool # (>) :: ExtKeyUsageFlag -> ExtKeyUsageFlag -> Bool # (>=) :: ExtKeyUsageFlag -> ExtKeyUsageFlag -> Bool # max :: ExtKeyUsageFlag -> ExtKeyUsageFlag -> ExtKeyUsageFlag # min :: ExtKeyUsageFlag -> ExtKeyUsageFlag -> ExtKeyUsageFlag #
Show ExtKeyUsageFlag # |
Instance details Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtKeyUsageFlag -> ShowS # show :: ExtKeyUsageFlag -> String # showList :: [ExtKeyUsageFlag] -> ShowS #

data ExtExtendedKeyUsage #

Extended key usage extension

Constructors

ExtExtendedKeyUsage [ExtKeyUsagePurpose] |

#### Instances

Instances details

Eq ExtExtendedKeyUsage # |
Instance details Defined in Data.X509.Ext Methods (==) :: ExtExtendedKeyUsage -> ExtExtendedKeyUsage -> Bool # (/=) :: ExtExtendedKeyUsage -> ExtExtendedKeyUsage -> Bool #
Show ExtExtendedKeyUsage # |
Instance details Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtExtendedKeyUsage -> ShowS # show :: ExtExtendedKeyUsage -> String # showList :: [ExtExtendedKeyUsage] -> ShowS #
Extension ExtExtendedKeyUsage # |
Instance details Defined in Data.X509.Ext Methods extOID :: ExtExtendedKeyUsage -> OID # extHasNestedASN1 :: Proxy ExtExtendedKeyUsage -> Bool # extEncode :: ExtExtendedKeyUsage -> [ASN1] # extDecode :: [ASN1] -> Either String ExtExtendedKeyUsage # extDecodeBs :: ByteString -> Either String ExtExtendedKeyUsage # extEncodeBs :: ExtExtendedKeyUsage -> ByteString #

data ExtKeyUsagePurpose #

Key usage purposes for the ExtendedKeyUsage extension

Constructors

KeyUsagePurpose_ServerAuth |
KeyUsagePurpose_ClientAuth |
KeyUsagePurpose_CodeSigning |
KeyUsagePurpose_EmailProtection |
KeyUsagePurpose_TimeStamping |
KeyUsagePurpose_OCSPSigning |
KeyUsagePurpose_Unknown OID |

#### Instances

Instances details

Eq ExtKeyUsagePurpose # |
Instance details Defined in Data.X509.Ext Methods (==) :: ExtKeyUsagePurpose -> ExtKeyUsagePurpose -> Bool # (/=) :: ExtKeyUsagePurpose -> ExtKeyUsagePurpose -> Bool #
Ord ExtKeyUsagePurpose # |
Instance details Defined in Data.X509.Ext Methods compare :: ExtKeyUsagePurpose -> ExtKeyUsagePurpose -> Ordering # (<) :: ExtKeyUsagePurpose -> ExtKeyUsagePurpose -> Bool # (<=) :: ExtKeyUsagePurpose -> ExtKeyUsagePurpose -> Bool # (>) :: ExtKeyUsagePurpose -> ExtKeyUsagePurpose -> Bool # (>=) :: ExtKeyUsagePurpose -> ExtKeyUsagePurpose -> Bool # max :: ExtKeyUsagePurpose -> ExtKeyUsagePurpose -> ExtKeyUsagePurpose # min :: ExtKeyUsagePurpose -> ExtKeyUsagePurpose -> ExtKeyUsagePurpose #
Show ExtKeyUsagePurpose # |
Instance details Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtKeyUsagePurpose -> ShowS # show :: ExtKeyUsagePurpose -> String # showList :: [ExtKeyUsagePurpose] -> ShowS #

data ExtSubjectKeyId #

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

Constructors

ExtSubjectKeyId ByteString |

#### Instances

Instances details

Eq ExtSubjectKeyId # |
Instance details Defined in Data.X509.Ext Methods (==) :: ExtSubjectKeyId -> ExtSubjectKeyId -> Bool # (/=) :: ExtSubjectKeyId -> ExtSubjectKeyId -> Bool #
Show ExtSubjectKeyId # |
Instance details Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtSubjectKeyId -> ShowS # show :: ExtSubjectKeyId -> String # showList :: [ExtSubjectKeyId] -> ShowS #
Extension ExtSubjectKeyId # |
Instance details Defined in Data.X509.Ext Methods extOID :: ExtSubjectKeyId -> OID # extHasNestedASN1 :: Proxy ExtSubjectKeyId -> Bool # extEncode :: ExtSubjectKeyId -> [ASN1] # extDecode :: [ASN1] -> Either String ExtSubjectKeyId # extDecodeBs :: ByteString -> Either String ExtSubjectKeyId # extEncodeBs :: ExtSubjectKeyId -> ByteString #

data ExtSubjectAltName #

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

Constructors

ExtSubjectAltName [AltName] |

#### Instances

Instances details

Eq ExtSubjectAltName # |
Instance details Defined in Data.X509.Ext Methods (==) :: ExtSubjectAltName -> ExtSubjectAltName -> Bool # (/=) :: ExtSubjectAltName -> ExtSubjectAltName -> Bool #
Ord ExtSubjectAltName # |
Instance details Defined in Data.X509.Ext Methods compare :: ExtSubjectAltName -> ExtSubjectAltName -> Ordering # (<) :: ExtSubjectAltName -> ExtSubjectAltName -> Bool # (<=) :: ExtSubjectAltName -> ExtSubjectAltName -> Bool # (>) :: ExtSubjectAltName -> ExtSubjectAltName -> Bool # (>=) :: ExtSubjectAltName -> ExtSubjectAltName -> Bool # max :: ExtSubjectAltName -> ExtSubjectAltName -> ExtSubjectAltName # min :: ExtSubjectAltName -> ExtSubjectAltName -> ExtSubjectAltName #
Show ExtSubjectAltName # |
Instance details Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtSubjectAltName -> ShowS # show :: ExtSubjectAltName -> String # showList :: [ExtSubjectAltName] -> ShowS #
Extension ExtSubjectAltName # |
Instance details Defined in Data.X509.Ext Methods extOID :: ExtSubjectAltName -> OID # extHasNestedASN1 :: Proxy ExtSubjectAltName -> Bool # extEncode :: ExtSubjectAltName -> [ASN1] # extDecode :: [ASN1] -> Either String ExtSubjectAltName # extDecodeBs :: ByteString -> Either String ExtSubjectAltName # extEncodeBs :: ExtSubjectAltName -> ByteString #

data ExtAuthorityKeyId #

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

Constructors

ExtAuthorityKeyId ByteString |

#### Instances

Instances details

Eq ExtAuthorityKeyId # |
Instance details Defined in Data.X509.Ext Methods (==) :: ExtAuthorityKeyId -> ExtAuthorityKeyId -> Bool # (/=) :: ExtAuthorityKeyId -> ExtAuthorityKeyId -> Bool #
Show ExtAuthorityKeyId # |
Instance details Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtAuthorityKeyId -> ShowS # show :: ExtAuthorityKeyId -> String # showList :: [ExtAuthorityKeyId] -> ShowS #
Extension ExtAuthorityKeyId # |
Instance details Defined in Data.X509.Ext Methods extOID :: ExtAuthorityKeyId -> OID # extHasNestedASN1 :: Proxy ExtAuthorityKeyId -> Bool # extEncode :: ExtAuthorityKeyId -> [ASN1] # extDecode :: [ASN1] -> Either String ExtAuthorityKeyId # extDecodeBs :: ByteString -> Either String ExtAuthorityKeyId # extEncodeBs :: ExtAuthorityKeyId -> ByteString #

data ExtCrlDistributionPoints #

Identify how CRL information is obtained

Constructors

ExtCrlDistributionPoints [DistributionPoint] |

#### Instances

Instances details

Eq ExtCrlDistributionPoints # |
Instance details Defined in Data.X509.Ext Methods (==) :: ExtCrlDistributionPoints -> ExtCrlDistributionPoints -> Bool # (/=) :: ExtCrlDistributionPoints -> ExtCrlDistributionPoints -> Bool #
Show ExtCrlDistributionPoints # |
Instance details Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtCrlDistributionPoints -> ShowS # show :: ExtCrlDistributionPoints -> String # showList :: [ExtCrlDistributionPoints] -> ShowS #
Extension ExtCrlDistributionPoints # |
Instance details Defined in Data.X509.Ext Methods extOID :: ExtCrlDistributionPoints -> OID # extHasNestedASN1 :: Proxy ExtCrlDistributionPoints -> Bool # extEncode :: ExtCrlDistributionPoints -> [ASN1] # extDecode :: [ASN1] -> Either String ExtCrlDistributionPoints # extDecodeBs :: ByteString -> Either String ExtCrlDistributionPoints # extEncodeBs :: ExtCrlDistributionPoints -> ByteString #

data ExtNetscapeComment #

Constructors

ExtNetscapeComment ByteString |

#### Instances

Instances details

Eq ExtNetscapeComment # |
Instance details Defined in Data.X509.Ext Methods (==) :: ExtNetscapeComment -> ExtNetscapeComment -> Bool # (/=) :: ExtNetscapeComment -> ExtNetscapeComment -> Bool #
Show ExtNetscapeComment # |
Instance details Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtNetscapeComment -> ShowS # show :: ExtNetscapeComment -> String # showList :: [ExtNetscapeComment] -> ShowS #
Extension ExtNetscapeComment # |
Instance details Defined in Data.X509.Ext Methods extOID :: ExtNetscapeComment -> OID # extHasNestedASN1 :: Proxy ExtNetscapeComment -> Bool # extEncode :: ExtNetscapeComment -> [ASN1] # extDecode :: [ASN1] -> Either String ExtNetscapeComment # extDecodeBs :: ByteString -> Either String ExtNetscapeComment # extEncodeBs :: ExtNetscapeComment -> ByteString #

data AltName #

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

Eq AltName # |
Instance details Defined in Data.X509.Ext Methods (==) :: AltName -> AltName -> Bool # (/=) :: AltName -> AltName -> Bool #
Ord AltName # |
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 #
Show AltName # |
Instance details Defined in Data.X509.Ext Methods showsPrec :: Int -> AltName -> ShowS # show :: AltName -> String # showList :: [AltName] -> ShowS #

data DistributionPoint #

Distribution point as either some GeneralNames or a DN

Constructors

DistributionPointFullName [AltName] |
DistributionNameRelative DistinguishedName |

#### Instances

Instances details

Eq DistributionPoint # |
Instance details Defined in Data.X509.Ext Methods (==) :: DistributionPoint -> DistributionPoint -> Bool # (/=) :: DistributionPoint -> DistributionPoint -> Bool #
Show DistributionPoint # |
Instance details Defined in Data.X509.Ext Methods showsPrec :: Int -> DistributionPoint -> ShowS # show :: DistributionPoint -> String # showList :: [DistributionPoint] -> ShowS #

data ReasonFlag #

Reason flag for the CRL

Constructors

Reason_Unused |
Reason_KeyCompromise |
Reason_CACompromise |
Reason_AffiliationChanged |
Reason_Superseded |
Reason_CessationOfOperation |
Reason_CertificateHold |
Reason_PrivilegeWithdrawn |
Reason_AACompromise |

#### Instances

Instances details

Enum ReasonFlag # |
Instance details Defined in Data.X509.Ext Methods succ :: ReasonFlag -> ReasonFlag # pred :: ReasonFlag -> ReasonFlag # toEnum :: Int -> ReasonFlag # fromEnum :: ReasonFlag -> Int # enumFrom :: ReasonFlag -> [ReasonFlag] # enumFromThen :: ReasonFlag -> ReasonFlag -> [ReasonFlag] # enumFromTo :: ReasonFlag -> ReasonFlag -> [ReasonFlag] # enumFromThenTo :: ReasonFlag -> ReasonFlag -> ReasonFlag -> [ReasonFlag] #
Eq ReasonFlag # |
Instance details Defined in Data.X509.Ext Methods (==) :: ReasonFlag -> ReasonFlag -> Bool # (/=) :: ReasonFlag -> ReasonFlag -> Bool #
Ord ReasonFlag # |
Instance details Defined in Data.X509.Ext Methods compare :: ReasonFlag -> ReasonFlag -> Ordering # (<) :: ReasonFlag -> ReasonFlag -> Bool # (<=) :: ReasonFlag -> ReasonFlag -> Bool # (>) :: ReasonFlag -> ReasonFlag -> Bool # (>=) :: ReasonFlag -> ReasonFlag -> Bool # max :: ReasonFlag -> ReasonFlag -> ReasonFlag # min :: ReasonFlag -> ReasonFlag -> ReasonFlag #
Show ReasonFlag # |
Instance details Defined in Data.X509.Ext Methods showsPrec :: Int -> ReasonFlag -> ShowS # show :: ReasonFlag -> String # showList :: [ReasonFlag] -> ShowS #

# Accessor turning extension into a specific one

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

Get a specific extension from a lists of raw extensions

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

Get a specific extension from a lists of raw extensions

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

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 :: forall a. Extension a => Bool -> a -> ExtensionRaw #

Encode an Extension to extensionRaw

data ExtensionRaw #

An undecoded extension

Constructors

ExtensionRaw |
Fields extRawOID :: OID OID of this extension extRawCritical :: Bool if this extension is critical extRawContent :: ByteString undecoded content

#### Instances

Instances details

Eq ExtensionRaw # |
Instance details Defined in Data.X509.ExtensionRaw Methods (==) :: ExtensionRaw -> ExtensionRaw -> Bool # (/=) :: ExtensionRaw -> ExtensionRaw -> Bool #
Show ExtensionRaw # |
Instance details Defined in Data.X509.ExtensionRaw Methods showsPrec :: Int -> ExtensionRaw -> ShowS # show :: ExtensionRaw -> String # showList :: [ExtensionRaw] -> ShowS #
ASN1Object ExtensionRaw # |
Instance details Defined in Data.X509.ExtensionRaw Methods toASN1 :: ExtensionRaw -> ASN1S # fromASN1 :: [ASN1] -> Either String (ExtensionRaw, [ASN1]) #

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

extRawASN1 :: ExtensionRaw -> [ASN1] #

Deprecated: use tryExtRawASN1 instead

newtype Extensions #

a Set of `ExtensionRaw`

Constructors

Extensions (Maybe [ExtensionRaw]) |

#### Instances

Instances details

Eq Extensions # |
Instance details Defined in Data.X509.ExtensionRaw Methods (==) :: Extensions -> Extensions -> Bool # (/=) :: Extensions -> Extensions -> Bool #
Show Extensions # |
Instance details Defined in Data.X509.ExtensionRaw Methods showsPrec :: Int -> Extensions -> ShowS # show :: Extensions -> String # showList :: [Extensions] -> ShowS #
ASN1Object Extensions # |
Instance details Defined in Data.X509.ExtensionRaw Methods toASN1 :: Extensions -> ASN1S # fromASN1 :: [ASN1] -> Either String (Extensions, [ASN1]) #

# Certificate Revocation List (CRL)

data CRL #

Describe a Certificate revocation list

Constructors

CRL |
Fields crlVersion :: Integer crlSignatureAlg :: SignatureALG crlIssuer :: DistinguishedName crlThisUpdate :: DateTime crlNextUpdate :: Maybe DateTime crlRevokedCertificates :: [RevokedCertificate] crlExtensions :: Extensions

#### Instances

Instances details

Eq CRL # |
Instance details Defined in Data.X509.CRL Methods (==) :: CRL -> CRL -> Bool # (/=) :: CRL -> CRL -> Bool #
Show CRL # |
Instance details Defined in Data.X509.CRL Methods showsPrec :: Int -> CRL -> ShowS # show :: CRL -> String # showList :: [CRL] -> ShowS #
ASN1Object CRL # |
Instance details Defined in Data.X509.CRL Methods toASN1 :: CRL -> ASN1S # fromASN1 :: [ASN1] -> Either String (CRL, [ASN1]) #

data RevokedCertificate #

Describe a revoked certificate identifiable by serial number.

Constructors

RevokedCertificate |
Fields revokedSerialNumber :: Integer revokedDate :: DateTime revokedExtensions :: Extensions

#### Instances

Instances details

Eq RevokedCertificate # |
Instance details Defined in Data.X509.CRL Methods (==) :: RevokedCertificate -> RevokedCertificate -> Bool # (/=) :: RevokedCertificate -> RevokedCertificate -> Bool #
Show RevokedCertificate # |
Instance details Defined in Data.X509.CRL Methods showsPrec :: Int -> RevokedCertificate -> ShowS # show :: RevokedCertificate -> String # showList :: [RevokedCertificate] -> ShowS #
ASN1Object RevokedCertificate # |
Instance details Defined in Data.X509.CRL Methods toASN1 :: RevokedCertificate -> ASN1S # fromASN1 :: [ASN1] -> Either String (RevokedCertificate, [ASN1]) #

# Naming

newtype DistinguishedName #

A list of OID and strings.

Constructors

DistinguishedName |
Fields getDistinguishedElements :: [(OID, ASN1CharacterString)]

#### Instances

Instances details

Eq DistinguishedName # |
Instance details Defined in Data.X509.DistinguishedName Methods (==) :: DistinguishedName -> DistinguishedName -> Bool # (/=) :: DistinguishedName -> DistinguishedName -> Bool #
Ord DistinguishedName # |
Instance details Defined in Data.X509.DistinguishedName Methods compare :: DistinguishedName -> DistinguishedName -> Ordering # (<) :: DistinguishedName -> DistinguishedName -> Bool # (<=) :: DistinguishedName -> DistinguishedName -> Bool # (>) :: DistinguishedName -> DistinguishedName -> Bool # (>=) :: DistinguishedName -> DistinguishedName -> Bool # max :: DistinguishedName -> DistinguishedName -> DistinguishedName # min :: DistinguishedName -> DistinguishedName -> DistinguishedName #
Show DistinguishedName # |
Instance details Defined in Data.X509.DistinguishedName Methods showsPrec :: Int -> DistinguishedName -> ShowS # show :: DistinguishedName -> String # showList :: [DistinguishedName] -> ShowS #
Semigroup DistinguishedName # |
Instance details Defined in Data.X509.DistinguishedName Methods (<>) :: DistinguishedName -> DistinguishedName -> DistinguishedName # sconcat :: NonEmpty DistinguishedName -> DistinguishedName # stimes :: Integral b => b -> DistinguishedName -> DistinguishedName #
Monoid DistinguishedName # |
Instance details Defined in Data.X509.DistinguishedName Methods mempty :: DistinguishedName # mappend :: DistinguishedName -> DistinguishedName -> DistinguishedName # mconcat :: [DistinguishedName] -> DistinguishedName #
ASN1Object DistinguishedName # |
Instance details Defined in Data.X509.DistinguishedName Methods toASN1 :: DistinguishedName -> ASN1S # fromASN1 :: [ASN1] -> Either String (DistinguishedName, [ASN1]) #

data DnElement #

Elements commonly available in a `DistinguishedName` structure

Constructors

DnCommonName | CN
DnCountry | Country
DnOrganization | O
DnOrganizationUnit | OU
DnEmailAddress | Email Address (legacy)

#### Instances

Instances details

Eq DnElement # |
Instance details Defined in Data.X509.DistinguishedName Methods (==) :: DnElement -> DnElement -> Bool # (/=) :: DnElement -> DnElement -> Bool #
Show DnElement # |
Instance details Defined in Data.X509.DistinguishedName Methods showsPrec :: Int -> DnElement -> ShowS # show :: DnElement -> String # showList :: [DnElement] -> ShowS #
OIDable DnElement # |
Instance details Defined in Data.X509.DistinguishedName Methods getObjectID :: DnElement -> OID #

data ASN1CharacterString #

ASN1 Character String with encoding

Constructors

ASN1CharacterString |
Fields characterEncoding :: ASN1StringEncoding getCharacterStringRawData :: ByteString

#### Instances

Instances details

Eq ASN1CharacterString |
Instance details Defined in Data.ASN1.Types.String Methods (==) :: ASN1CharacterString -> ASN1CharacterString -> Bool # (/=) :: ASN1CharacterString -> ASN1CharacterString -> Bool #
Ord ASN1CharacterString |
Instance details Defined in Data.ASN1.Types.String Methods compare :: ASN1CharacterString -> ASN1CharacterString -> Ordering # (<) :: ASN1CharacterString -> ASN1CharacterString -> Bool # (<=) :: ASN1CharacterString -> ASN1CharacterString -> Bool # (>) :: ASN1CharacterString -> ASN1CharacterString -> Bool # (>=) :: ASN1CharacterString -> ASN1CharacterString -> Bool # max :: ASN1CharacterString -> ASN1CharacterString -> ASN1CharacterString # min :: ASN1CharacterString -> ASN1CharacterString -> ASN1CharacterString #
Show ASN1CharacterString |
Instance details Defined in Data.ASN1.Types.String Methods showsPrec :: Int -> ASN1CharacterString -> ShowS # show :: ASN1CharacterString -> String # showList :: [ASN1CharacterString] -> ShowS #
IsString ASN1CharacterString |
Instance details Defined in Data.ASN1.Types.String Methods fromString :: String -> ASN1CharacterString #

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

Try to get a specific element in a `DistinguishedName` structure

# Certificate Chain

newtype CertificateChain #

A chain of X.509 certificates in exact form.

Constructors

CertificateChain [SignedExact Certificate] |

#### Instances

Instances details

Eq CertificateChain # |
Instance details Defined in Data.X509.CertificateChain Methods (==) :: CertificateChain -> CertificateChain -> Bool # (/=) :: CertificateChain -> CertificateChain -> Bool #
Show CertificateChain # |
Instance details Defined in Data.X509.CertificateChain Methods showsPrec :: Int -> CertificateChain -> ShowS # show :: CertificateChain -> String # showList :: [CertificateChain] -> ShowS #

newtype CertificateChainRaw #

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

Constructors

CertificateChainRaw [ByteString] |

#### Instances

Instances details

Eq CertificateChainRaw # |
Instance details Defined in Data.X509.CertificateChain Methods (==) :: CertificateChainRaw -> CertificateChainRaw -> Bool # (/=) :: CertificateChainRaw -> CertificateChainRaw -> Bool #
Show CertificateChainRaw # |
Instance details Defined in Data.X509.CertificateChain Methods showsPrec :: Int -> CertificateChainRaw -> ShowS # show :: CertificateChainRaw -> String # showList :: [CertificateChainRaw] -> ShowS #

# marshall between CertificateChain and CertificateChainRaw

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

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 #

Convert a CertificateChain into a CertificateChainRaw

# Signed types and marshalling

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

Represent a signed object using a traditional X509 structure.

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

Constructors

Signed |
Fields signedObject :: a Object to sign signedAlg :: SignatureALG Signature Algorithm used signedSignature :: ByteString Signature as bytes

#### Instances

Instances details

(Show a, Eq a, ASN1Object a) => Eq (Signed a) # |
Instance details Defined in Data.X509.Signed Methods (==) :: Signed a -> Signed a -> Bool # (/=) :: Signed a -> Signed a -> Bool #
(Show a, Eq a, ASN1Object a) => Show (Signed a) # |
Instance details Defined in Data.X509.Signed Methods showsPrec :: Int -> Signed a -> ShowS # show :: Signed a -> String # showList :: [Signed a] -> ShowS #

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

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) => Eq (SignedExact a) # |
Instance details Defined in Data.X509.Signed Methods (==) :: SignedExact a -> SignedExact a -> Bool # (/=) :: SignedExact a -> SignedExact a -> Bool #
(Show a, Eq a, ASN1Object a) => Show (SignedExact a) # |
Instance details Defined in Data.X509.Signed Methods showsPrec :: Int -> SignedExact a -> ShowS # show :: SignedExact a -> String # showList :: [SignedExact a] -> ShowS #

getSigned :: SignedExact a -> Signed a #

get the decoded Signed data

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

Get the signed data for the signature

objectToSignedExact #

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 #

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 #

The raw representation of the whole signed structure

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

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

# Parametrized Signed accessor

getCertificate :: SignedCertificate -> Certificate #

Get the Certificate associated to a SignedCertificate

getCRL :: SignedCRL -> CRL #

Get the CRL associated to a SignedCRL

decodeSignedCertificate :: ByteString -> Either String SignedCertificate #

Try to decode a bytestring to a SignedCertificate

decodeSignedCRL :: ByteString -> Either String SignedCRL #

Try to decode a bytestring to a SignedCRL

# Hash distinguished names related function

hashDN :: DistinguishedName -> ByteString #

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 #

Create an openssl style old hash of distinguished name