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 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

- 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

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

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

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

data PubKeyEC Source #

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

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

newtype SerializedPoint Source #

Serialized Elliptic Curve Point

Constructors

SerializedPoint ByteString |

Instances

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

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

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

data PrivKeyEC Source #

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

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

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

Constructors

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

Instances

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

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

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

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.

Constructors

SignatureALG HashALG PubKeyALG |
SignatureALG_IntrinsicHash PubKeyALG |
SignatureALG_Unknown OID |

Instances

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

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

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

Instance details

Defined in Data.X509.Ext

Methods

extOID :: ExtCrlDistributionPoints -> OID Source #

extHasNestedASN1 :: Proxy ExtCrlDistributionPoints -> Bool Source #

extEncode :: ExtCrlDistributionPoints -> [ASN1] Source #

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

extDecodeBs :: ByteString -> Either String ExtCrlDistributionPoints Source #

extEncodeBs :: ExtCrlDistributionPoints -> ByteString Source #

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 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 #
Extension ExtExtendedKeyUsage Source # |

Instance details

Defined in Data.X509.Ext

Methods

extOID :: ExtExtendedKeyUsage -> OID Source #

extHasNestedASN1 :: Proxy ExtExtendedKeyUsage -> Bool Source #

extEncode :: ExtExtendedKeyUsage -> [ASN1] Source #

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

extDecodeBs :: ByteString -> Either String ExtExtendedKeyUsage Source #

extEncodeBs :: ExtExtendedKeyUsage -> ByteString Source #

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 ExtBasicConstraints Source # |

Instance details

Defined in Data.X509.Ext

Methods

extOID :: ExtBasicConstraints -> OID Source #

extHasNestedASN1 :: Proxy ExtBasicConstraints -> Bool Source #

extEncode :: ExtBasicConstraints -> [ASN1] Source #

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

extDecodeBs :: ByteString -> Either String ExtBasicConstraints Source #

extEncodeBs :: ExtBasicConstraints -> ByteString Source #

# Common extension usually found in x509v3

data ExtBasicConstraints Source #

Basic Constraints

Constructors

ExtBasicConstraints Bool (Maybe Integer) |

Instances

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

Instance details

Defined in Data.X509.Ext

Methods

extOID :: ExtBasicConstraints -> OID Source #

extHasNestedASN1 :: Proxy ExtBasicConstraints -> Bool Source #

extEncode :: ExtBasicConstraints -> [ASN1] Source #

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

extDecodeBs :: ByteString -> Either String ExtBasicConstraints Source #

extEncodeBs :: ExtBasicConstraints -> ByteString Source #

data ExtKeyUsage Source #

Describe key usage

Constructors

ExtKeyUsage [ExtKeyUsageFlag] |

Instances

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

Constructors

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

Instances

Enum ExtKeyUsageFlag Source # |

Instance details

Defined in Data.X509.Ext

Methods

succ :: ExtKeyUsageFlag -> ExtKeyUsageFlag Source #

pred :: ExtKeyUsageFlag -> ExtKeyUsageFlag Source #

toEnum :: Int -> ExtKeyUsageFlag Source #

fromEnum :: ExtKeyUsageFlag -> Int Source #

enumFrom :: ExtKeyUsageFlag -> [ExtKeyUsageFlag] Source #

enumFromThen :: ExtKeyUsageFlag -> ExtKeyUsageFlag -> [ExtKeyUsageFlag] Source #

enumFromTo :: ExtKeyUsageFlag -> ExtKeyUsageFlag -> [ExtKeyUsageFlag] Source #

enumFromThenTo :: ExtKeyUsageFlag -> ExtKeyUsageFlag -> ExtKeyUsageFlag -> [ExtKeyUsageFlag] Source #

Eq ExtKeyUsageFlag Source # |
Instance details Defined in Data.X509.Ext Methods (==) :: ExtKeyUsageFlag -> ExtKeyUsageFlag -> Bool Source # (/=) :: ExtKeyUsageFlag -> ExtKeyUsageFlag -> Bool Source #
Ord ExtKeyUsageFlag Source # |

Instance details

Defined in Data.X509.Ext

Methods

compare :: ExtKeyUsageFlag -> ExtKeyUsageFlag -> Ordering Source #

(<) :: ExtKeyUsageFlag -> ExtKeyUsageFlag -> Bool Source #

(<=) :: ExtKeyUsageFlag -> ExtKeyUsageFlag -> Bool Source #

(>) :: ExtKeyUsageFlag -> ExtKeyUsageFlag -> Bool Source #

(>=) :: ExtKeyUsageFlag -> ExtKeyUsageFlag -> Bool Source #

max :: ExtKeyUsageFlag -> ExtKeyUsageFlag -> ExtKeyUsageFlag Source #

min :: ExtKeyUsageFlag -> ExtKeyUsageFlag -> ExtKeyUsageFlag Source #

Show ExtKeyUsageFlag Source # |
Instance details Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtKeyUsageFlag -> ShowS Source # show :: ExtKeyUsageFlag -> String Source # showList :: [ExtKeyUsageFlag] -> ShowS Source #

data ExtExtendedKeyUsage Source #

Extended key usage extension

Constructors

ExtExtendedKeyUsage [ExtKeyUsagePurpose] |

Instances

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

Instance details

Defined in Data.X509.Ext

Methods

extOID :: ExtExtendedKeyUsage -> OID Source #

extHasNestedASN1 :: Proxy ExtExtendedKeyUsage -> Bool Source #

extEncode :: ExtExtendedKeyUsage -> [ASN1] Source #

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

extDecodeBs :: ByteString -> Either String ExtExtendedKeyUsage Source #

extEncodeBs :: ExtExtendedKeyUsage -> ByteString Source #

data ExtKeyUsagePurpose Source #

Key usage purposes for the ExtendedKeyUsage extension

Constructors

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

Instances

Eq ExtKeyUsagePurpose Source # |
Instance details Defined in Data.X509.Ext Methods (==) :: ExtKeyUsagePurpose -> ExtKeyUsagePurpose -> Bool Source # (/=) :: ExtKeyUsagePurpose -> ExtKeyUsagePurpose -> Bool Source #
Ord ExtKeyUsagePurpose Source # |

Instance details

Defined in Data.X509.Ext

Methods

compare :: ExtKeyUsagePurpose -> ExtKeyUsagePurpose -> Ordering Source #

(<) :: ExtKeyUsagePurpose -> ExtKeyUsagePurpose -> Bool Source #

(<=) :: ExtKeyUsagePurpose -> ExtKeyUsagePurpose -> Bool Source #

(>) :: ExtKeyUsagePurpose -> ExtKeyUsagePurpose -> Bool Source #

(>=) :: ExtKeyUsagePurpose -> ExtKeyUsagePurpose -> Bool Source #

max :: ExtKeyUsagePurpose -> ExtKeyUsagePurpose -> ExtKeyUsagePurpose Source #

min :: ExtKeyUsagePurpose -> ExtKeyUsagePurpose -> ExtKeyUsagePurpose Source #

Show ExtKeyUsagePurpose Source # |
Instance details Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtKeyUsagePurpose -> ShowS Source # show :: ExtKeyUsagePurpose -> String Source # showList :: [ExtKeyUsagePurpose] -> ShowS Source #

data ExtSubjectKeyId Source #

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

Constructors

ExtSubjectKeyId ByteString |

Instances

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

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

Constructors

ExtSubjectAltName [AltName] |

Instances

Eq ExtSubjectAltName Source # |
Instance details Defined in Data.X509.Ext Methods (==) :: ExtSubjectAltName -> ExtSubjectAltName -> Bool Source # (/=) :: ExtSubjectAltName -> ExtSubjectAltName -> Bool Source #
Ord ExtSubjectAltName Source # |

Instance details

Defined in Data.X509.Ext

Methods

compare :: ExtSubjectAltName -> ExtSubjectAltName -> Ordering Source #

(<) :: ExtSubjectAltName -> ExtSubjectAltName -> Bool Source #

(<=) :: ExtSubjectAltName -> ExtSubjectAltName -> Bool Source #

(>) :: ExtSubjectAltName -> ExtSubjectAltName -> Bool Source #

(>=) :: ExtSubjectAltName -> ExtSubjectAltName -> Bool Source #

max :: ExtSubjectAltName -> ExtSubjectAltName -> ExtSubjectAltName Source #

min :: ExtSubjectAltName -> ExtSubjectAltName -> ExtSubjectAltName Source #

Show ExtSubjectAltName Source # |
Instance details Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtSubjectAltName -> ShowS Source # show :: ExtSubjectAltName -> String Source # showList :: [ExtSubjectAltName] -> ShowS Source #
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 #

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

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

Identify how CRL information is obtained

Constructors

ExtCrlDistributionPoints [DistributionPoint] |

Instances

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

Instance details

Defined in Data.X509.Ext

Methods

extOID :: ExtCrlDistributionPoints -> OID Source #

extHasNestedASN1 :: Proxy ExtCrlDistributionPoints -> Bool Source #

extEncode :: ExtCrlDistributionPoints -> [ASN1] Source #

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

extDecodeBs :: ByteString -> Either String ExtCrlDistributionPoints Source #

extEncodeBs :: ExtCrlDistributionPoints -> ByteString Source #

data ExtNetscapeComment Source #

Constructors

ExtNetscapeComment ByteString |

Instances

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

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

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

data DistributionPoint Source #

Distribution point as either some GeneralNames or a DN

Constructors

DistributionPointFullName [AltName] |
DistributionNameRelative DistinguishedName |

Instances

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

data ReasonFlag Source #

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

Enum ReasonFlag Source # |

Instance details

Defined in Data.X509.Ext

Methods

succ :: ReasonFlag -> ReasonFlag Source #

pred :: ReasonFlag -> ReasonFlag Source #

toEnum :: Int -> ReasonFlag Source #

fromEnum :: ReasonFlag -> Int Source #

enumFrom :: ReasonFlag -> [ReasonFlag] Source #

enumFromThen :: ReasonFlag -> ReasonFlag -> [ReasonFlag] Source #

enumFromTo :: ReasonFlag -> ReasonFlag -> [ReasonFlag] Source #

enumFromThenTo :: ReasonFlag -> ReasonFlag -> ReasonFlag -> [ReasonFlag] Source #

Eq ReasonFlag Source # |
Instance details Defined in Data.X509.Ext Methods (==) :: ReasonFlag -> ReasonFlag -> Bool Source # (/=) :: ReasonFlag -> ReasonFlag -> Bool Source #
Ord ReasonFlag Source # |

Instance details

Defined in Data.X509.Ext

Methods

compare :: ReasonFlag -> ReasonFlag -> Ordering Source #

(<) :: ReasonFlag -> ReasonFlag -> Bool Source #

(<=) :: ReasonFlag -> ReasonFlag -> Bool Source #

(>) :: ReasonFlag -> ReasonFlag -> Bool Source #

(>=) :: ReasonFlag -> ReasonFlag -> Bool Source #

max :: ReasonFlag -> ReasonFlag -> ReasonFlag Source #

min :: ReasonFlag -> ReasonFlag -> ReasonFlag Source #

Show ReasonFlag Source # |
Instance details Defined in Data.X509.Ext Methods showsPrec :: Int -> ReasonFlag -> ShowS Source # show :: ReasonFlag -> String Source # showList :: [ReasonFlag] -> ShowS Source #

# Accessor turning extension into a specific one

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

Encode an Extension to extensionRaw

data ExtensionRaw Source #

An undecoded extension

Constructors

ExtensionRaw |

Fields

- extRawOID :: OID

  OID of this extension

- extRawCritical :: Bool

  if this extension is critical

- extRawContent :: ByteString

  undecoded content

Instances

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

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

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

# Certificate Revocation List (CRL)

data CRL Source #

Describe a Certificate revocation list

Constructors

CRL |

Fields

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

Instances

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

data RevokedCertificate Source #

Describe a revoked certificate identifiable by serial number.

Constructors

RevokedCertificate |

Fields

- revokedSerialNumber :: Integer
- revokedDate :: DateTime
- revokedExtensions :: Extensions

Instances

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

# Naming

newtype DistinguishedName Source #

A list of OID and strings.

Constructors

DistinguishedName |

Fields

- getDistinguishedElements :: [(OID, ASN1CharacterString)]

Instances

Eq DistinguishedName Source # |
Instance details Defined in Data.X509.DistinguishedName Methods (==) :: DistinguishedName -> DistinguishedName -> Bool Source # (/=) :: DistinguishedName -> DistinguishedName -> Bool Source #
Ord DistinguishedName Source # |

Instance details

Defined in Data.X509.DistinguishedName

Methods

compare :: DistinguishedName -> DistinguishedName -> Ordering Source #

(<) :: DistinguishedName -> DistinguishedName -> Bool Source #

(<=) :: DistinguishedName -> DistinguishedName -> Bool Source #

(>) :: DistinguishedName -> DistinguishedName -> Bool Source #

(>=) :: DistinguishedName -> DistinguishedName -> Bool Source #

max :: DistinguishedName -> DistinguishedName -> DistinguishedName Source #

min :: DistinguishedName -> DistinguishedName -> DistinguishedName Source #

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

data DnElement Source #

Elements commonly available in a `DistinguishedName` structure

Constructors

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

Instances

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

data ASN1CharacterString Source #

ASN1 Character String with encoding

Constructors

ASN1CharacterString |

Fields

- characterEncoding :: ASN1StringEncoding
- getCharacterStringRawData :: ByteString

Instances

Eq ASN1CharacterString |
Instance details Defined in Data.ASN1.Types.String Methods (==) :: ASN1CharacterString -> ASN1CharacterString -> Bool Source # (/=) :: ASN1CharacterString -> ASN1CharacterString -> Bool Source #
Ord ASN1CharacterString |

Instance details

Defined in Data.ASN1.Types.String

Methods

compare :: ASN1CharacterString -> ASN1CharacterString -> Ordering Source #

(<) :: ASN1CharacterString -> ASN1CharacterString -> Bool Source #

(<=) :: ASN1CharacterString -> ASN1CharacterString -> Bool Source #

(>) :: ASN1CharacterString -> ASN1CharacterString -> Bool Source #

(>=) :: ASN1CharacterString -> ASN1CharacterString -> Bool Source #

max :: ASN1CharacterString -> ASN1CharacterString -> ASN1CharacterString Source #

min :: ASN1CharacterString -> ASN1CharacterString -> ASN1CharacterString Source #

Show ASN1CharacterString |
Instance details Defined in Data.ASN1.Types.String Methods showsPrec :: Int -> ASN1CharacterString -> ShowS Source # show :: ASN1CharacterString -> String Source # showList :: [ASN1CharacterString] -> ShowS Source #
IsString ASN1CharacterString |
Instance details Defined in Data.ASN1.Types.String Methods fromString :: String -> ASN1CharacterString Source #

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.

Constructors

CertificateChain [SignedExact Certificate] |

Instances

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

newtype CertificateChainRaw Source #

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

Constructors

CertificateChainRaw [ByteString] |

Instances

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

# marshall between CertificateChain and CertificateChainRaw

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

- signedObject :: a

  Object to sign

- signedAlg :: SignatureALG

  Signature Algorithm used

- signedSignature :: ByteString

  Signature as bytes

Instances

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

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

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

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