| License | BSD-style |
|---|---|
| Maintainer | Vincent Hanquez <vincent@snarc.org> |
| Stability | experimental |
| Portability | unknown |
| Safe Haskell | None |
| Language | Haskell2010 |
Data.X509
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 {}
- data PubKey
- data PubKeyEC
- = PubKeyEC_Prime { }
- | PubKeyEC_Named { }
- newtype SerializedPoint = SerializedPoint ByteString
- data PrivKey
- data PrivKeyEC
- = PrivKeyEC_Prime { }
- | PrivKeyEC_Named { }
- pubkeyToAlg :: PubKey -> PubKeyALG
- privkeyToAlg :: PrivKey -> PubKeyALG
- data HashALG
- data PubKeyALG
- data SignatureALG
- extensionDecode :: Extension a => ExtensionRaw -> Maybe (Either String a)
- extensionEncode :: Extension a => Bool -> a -> ExtensionRaw
- extensionGet :: Extension a => Extensions -> Maybe a
- extensionGetE :: Extension a => Extensions -> Maybe (Either String a)
- data AltName
- data DistributionPoint
- data ExtAuthorityKeyId = ExtAuthorityKeyId ByteString
- data ExtBasicConstraints = ExtBasicConstraints Bool (Maybe Integer)
- data ExtCrlDistributionPoints = ExtCrlDistributionPoints [DistributionPoint]
- data ExtExtendedKeyUsage = ExtExtendedKeyUsage [ExtKeyUsagePurpose]
- data ExtKeyUsage = ExtKeyUsage [ExtKeyUsageFlag]
- data ExtKeyUsageFlag
- data ExtKeyUsagePurpose
- data ExtNetscapeComment = ExtNetscapeComment ByteString
- data ExtSubjectAltName = ExtSubjectAltName [AltName]
- data ExtSubjectKeyId = ExtSubjectKeyId ByteString
- 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 ReasonFlag
- extRawASN1 :: ExtensionRaw -> [ASN1]
- tryExtRawASN1 :: ExtensionRaw -> Either String [ASN1]
- data ExtensionRaw = ExtensionRaw {}
- newtype Extensions = Extensions (Maybe [ExtensionRaw])
- data CRL = CRL {}
- data RevokedCertificate = RevokedCertificate {}
- newtype DistinguishedName = DistinguishedName {}
- data DnElement
- data ASN1CharacterString = ASN1CharacterString {}
- getDnElement :: DnElement -> DistinguishedName -> Maybe ASN1CharacterString
- decodeCertificateChain :: CertificateChainRaw -> Either (Int, String) CertificateChain
- encodeCertificateChain :: CertificateChain -> CertificateChainRaw
- newtype CertificateChain = CertificateChain [SignedExact Certificate]
- newtype CertificateChainRaw = CertificateChainRaw [ByteString]
- data (Show a, Eq a, ASN1Object a) => Signed a = Signed {}
- 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
| |
Instances
| ASN1Object Certificate Source # | |
Defined in Data.X509.Cert | |
| Eq Certificate Source # | |
Defined in Data.X509.Cert | |
| Show Certificate Source # | |
Defined in Data.X509.Cert Methods showsPrec :: Int -> Certificate -> ShowS # show :: Certificate -> String # showList :: [Certificate] -> ShowS # | |
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 |
Elliptic Curve Public Key
TODO: missing support for binary curve.
Constructors
| PubKeyEC_Prime | |
Fields | |
| PubKeyEC_Named | |
Fields | |
Instances
newtype SerializedPoint Source #
Serialized Elliptic Curve Point
Constructors
| SerializedPoint ByteString |
Instances
| Eq SerializedPoint Source # | |
Defined in Data.X509.PublicKey Methods (==) :: SerializedPoint -> SerializedPoint -> Bool # (/=) :: SerializedPoint -> SerializedPoint -> Bool # | |
| Show SerializedPoint Source # | |
Defined in Data.X509.PublicKey Methods showsPrec :: Int -> SerializedPoint -> ShowS # show :: SerializedPoint -> String # showList :: [SerializedPoint] -> ShowS # | |
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 |
Elliptic Curve Private Key
TODO: missing support for binary curve.
Constructors
| PrivKeyEC_Prime | |
| PrivKeyEC_Named | |
Fields | |
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
Hash Algorithm
Constructors
| HashMD2 | |
| HashMD5 | |
| HashSHA1 | |
| HashSHA224 | |
| HashSHA256 | |
| HashSHA384 | |
| HashSHA512 |
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 |
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
| ASN1Object SignatureALG Source # | |
Defined in Data.X509.AlgorithmIdentifier | |
| Eq SignatureALG Source # | |
Defined in Data.X509.AlgorithmIdentifier | |
| Show SignatureALG Source # | |
Defined in Data.X509.AlgorithmIdentifier Methods showsPrec :: Int -> SignatureALG -> ShowS # show :: SignatureALG -> String # showList :: [SignatureALG] -> ShowS # | |
extensionDecode :: Extension a => ExtensionRaw -> Maybe (Either String a) Source #
Try to decode an ExtensionRaw.
If this function return: * Nothing, the OID doesn't match * Just Left, the OID matched, but the extension couldn't be decoded * Just Right, the OID matched, and the extension has been succesfully decoded
extensionEncode :: Extension a => Bool -> a -> ExtensionRaw Source #
Encode an Extension to extensionRaw
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
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 |
data DistributionPoint Source #
Distribution point as either some GeneralNames or a DN
Instances
| Eq DistributionPoint Source # | |
Defined in Data.X509.Ext Methods (==) :: DistributionPoint -> DistributionPoint -> Bool # (/=) :: DistributionPoint -> DistributionPoint -> Bool # | |
| Show DistributionPoint Source # | |
Defined in Data.X509.Ext Methods showsPrec :: Int -> DistributionPoint -> ShowS # show :: DistributionPoint -> String # showList :: [DistributionPoint] -> ShowS # | |
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
| Extension ExtAuthorityKeyId Source # | |
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 # | |
| Eq ExtAuthorityKeyId Source # | |
Defined in Data.X509.Ext Methods (==) :: ExtAuthorityKeyId -> ExtAuthorityKeyId -> Bool # (/=) :: ExtAuthorityKeyId -> ExtAuthorityKeyId -> Bool # | |
| Show ExtAuthorityKeyId Source # | |
Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtAuthorityKeyId -> ShowS # show :: ExtAuthorityKeyId -> String # showList :: [ExtAuthorityKeyId] -> ShowS # | |
data ExtBasicConstraints Source #
Basic Constraints
Constructors
| ExtBasicConstraints Bool (Maybe Integer) |
Instances
| Extension ExtBasicConstraints Source # | |
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 # | |
| Eq ExtBasicConstraints Source # | |
Defined in Data.X509.Ext Methods (==) :: ExtBasicConstraints -> ExtBasicConstraints -> Bool # (/=) :: ExtBasicConstraints -> ExtBasicConstraints -> Bool # | |
| Show ExtBasicConstraints Source # | |
Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtBasicConstraints -> ShowS # show :: ExtBasicConstraints -> String # showList :: [ExtBasicConstraints] -> ShowS # | |
data ExtCrlDistributionPoints Source #
Identify how CRL information is obtained
Constructors
| ExtCrlDistributionPoints [DistributionPoint] |
Instances
| Extension ExtCrlDistributionPoints Source # | |
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 # | |
| Eq ExtCrlDistributionPoints Source # | |
Defined in Data.X509.Ext Methods (==) :: ExtCrlDistributionPoints -> ExtCrlDistributionPoints -> Bool # (/=) :: ExtCrlDistributionPoints -> ExtCrlDistributionPoints -> Bool # | |
| Show ExtCrlDistributionPoints Source # | |
Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtCrlDistributionPoints -> ShowS # show :: ExtCrlDistributionPoints -> String # showList :: [ExtCrlDistributionPoints] -> ShowS # | |
data ExtExtendedKeyUsage Source #
Extended key usage extension
Constructors
| ExtExtendedKeyUsage [ExtKeyUsagePurpose] |
Instances
| Extension ExtExtendedKeyUsage Source # | |
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 # | |
| Eq ExtExtendedKeyUsage Source # | |
Defined in Data.X509.Ext Methods (==) :: ExtExtendedKeyUsage -> ExtExtendedKeyUsage -> Bool # (/=) :: ExtExtendedKeyUsage -> ExtExtendedKeyUsage -> Bool # | |
| Show ExtExtendedKeyUsage Source # | |
Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtExtendedKeyUsage -> ShowS # show :: ExtExtendedKeyUsage -> String # showList :: [ExtExtendedKeyUsage] -> ShowS # | |
data ExtKeyUsage Source #
Describe key usage
Constructors
| ExtKeyUsage [ExtKeyUsageFlag] |
Instances
| Extension ExtKeyUsage Source # | |
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 # | |
| Eq ExtKeyUsage Source # | |
Defined in Data.X509.Ext | |
| Show ExtKeyUsage Source # | |
Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtKeyUsage -> ShowS # show :: ExtKeyUsage -> String # showList :: [ExtKeyUsage] -> ShowS # | |
data ExtKeyUsageFlag Source #
key usage flag that is found in the key usage extension field.
Constructors
Instances
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 # | |
Defined in Data.X509.Ext Methods (==) :: ExtKeyUsagePurpose -> ExtKeyUsagePurpose -> Bool # (/=) :: ExtKeyUsagePurpose -> ExtKeyUsagePurpose -> Bool # | |
| Ord ExtKeyUsagePurpose Source # | |
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 Source # | |
Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtKeyUsagePurpose -> ShowS # show :: ExtKeyUsagePurpose -> String # showList :: [ExtKeyUsagePurpose] -> ShowS # | |
data ExtNetscapeComment Source #
Constructors
| ExtNetscapeComment ByteString |
Instances
| Extension ExtNetscapeComment Source # | |
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 # | |
| Eq ExtNetscapeComment Source # | |
Defined in Data.X509.Ext Methods (==) :: ExtNetscapeComment -> ExtNetscapeComment -> Bool # (/=) :: ExtNetscapeComment -> ExtNetscapeComment -> Bool # | |
| Show ExtNetscapeComment Source # | |
Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtNetscapeComment -> ShowS # show :: ExtNetscapeComment -> String # showList :: [ExtNetscapeComment] -> ShowS # | |
data ExtSubjectAltName Source #
Provide a way to supply alternate name that can be used for matching host name.
Constructors
| ExtSubjectAltName [AltName] |
Instances
data ExtSubjectKeyId Source #
Provide a way to identify a public key by a short hash.
Constructors
| ExtSubjectKeyId ByteString |
Instances
| Extension ExtSubjectKeyId Source # | |
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 # | |
| Eq ExtSubjectKeyId Source # | |
Defined in Data.X509.Ext Methods (==) :: ExtSubjectKeyId -> ExtSubjectKeyId -> Bool # (/=) :: ExtSubjectKeyId -> ExtSubjectKeyId -> Bool # | |
| Show ExtSubjectKeyId Source # | |
Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtSubjectKeyId -> ShowS # show :: ExtSubjectKeyId -> String # showList :: [ExtSubjectKeyId] -> ShowS # | |
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
Methods
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
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
| Eq ReasonFlag Source # | |
Defined in Data.X509.Ext | |
| Ord ReasonFlag Source # | |
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 # | |
| Enum ReasonFlag Source # | |
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] # | |
| Show ReasonFlag Source # | |
Defined in Data.X509.Ext Methods showsPrec :: Int -> ReasonFlag -> ShowS # show :: ReasonFlag -> String # showList :: [ReasonFlag] -> ShowS # | |
extRawASN1 :: ExtensionRaw -> [ASN1] Source #
Deprecated: use tryExtRawASN1 instead
tryExtRawASN1 :: ExtensionRaw -> Either String [ASN1] Source #
data ExtensionRaw Source #
An undecoded extension
Constructors
| ExtensionRaw | |
Fields
| |
Instances
| ASN1Object ExtensionRaw Source # | |
Defined in Data.X509.ExtensionRaw | |
| Eq ExtensionRaw Source # | |
Defined in Data.X509.ExtensionRaw | |
| Show ExtensionRaw Source # | |
Defined in Data.X509.ExtensionRaw Methods showsPrec :: Int -> ExtensionRaw -> ShowS # show :: ExtensionRaw -> String # showList :: [ExtensionRaw] -> ShowS # | |
newtype Extensions Source #
a Set of ExtensionRaw
Constructors
| Extensions (Maybe [ExtensionRaw]) |
Instances
| ASN1Object Extensions Source # | |
Defined in Data.X509.ExtensionRaw | |
| Eq Extensions Source # | |
Defined in Data.X509.ExtensionRaw | |
| Show Extensions Source # | |
Defined in Data.X509.ExtensionRaw Methods showsPrec :: Int -> Extensions -> ShowS # show :: Extensions -> String # showList :: [Extensions] -> ShowS # | |
Certificate Revocation List (CRL)
Describe a Certificate revocation list
Constructors
| CRL | |
data RevokedCertificate Source #
Describe a revoked certificate identifiable by serial number.
Constructors
| RevokedCertificate | |
Fields | |
Instances
| ASN1Object RevokedCertificate Source # | |
Defined in Data.X509.CRL | |
| Eq RevokedCertificate Source # | |
Defined in Data.X509.CRL Methods (==) :: RevokedCertificate -> RevokedCertificate -> Bool # (/=) :: RevokedCertificate -> RevokedCertificate -> Bool # | |
| Show RevokedCertificate Source # | |
Defined in Data.X509.CRL Methods showsPrec :: Int -> RevokedCertificate -> ShowS # show :: RevokedCertificate -> String # showList :: [RevokedCertificate] -> ShowS # | |
Naming
newtype DistinguishedName Source #
A list of OID and strings.
Constructors
| DistinguishedName | |
Fields | |
Instances
Elements commonly available in a DistinguishedName structure
Constructors
| DnCommonName | CN |
| DnCountry | Country |
| DnOrganization | O |
| DnOrganizationUnit | OU |
| DnEmailAddress | Email Address (legacy) |
data ASN1CharacterString Source #
ASN1 Character String with encoding
Constructors
| ASN1CharacterString | |
Instances
getDnElement :: DnElement -> DistinguishedName -> Maybe ASN1CharacterString Source #
Try to get a specific element in a DistinguishedName structure
Certificate Chain
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
newtype CertificateChain Source #
A chain of X.509 certificates in exact form.
Constructors
| CertificateChain [SignedExact Certificate] |
Instances
| Eq CertificateChain Source # | |
Defined in Data.X509.CertificateChain Methods (==) :: CertificateChain -> CertificateChain -> Bool # (/=) :: CertificateChain -> CertificateChain -> Bool # | |
| Show CertificateChain Source # | |
Defined in Data.X509.CertificateChain Methods showsPrec :: Int -> CertificateChain -> ShowS # show :: CertificateChain -> String # showList :: [CertificateChain] -> ShowS # | |
newtype CertificateChainRaw Source #
Represent a chain of X.509 certificates in bytestring form.
Constructors
| CertificateChainRaw [ByteString] |
Instances
| Eq CertificateChainRaw Source # | |
Defined in Data.X509.CertificateChain Methods (==) :: CertificateChainRaw -> CertificateChainRaw -> Bool # (/=) :: CertificateChainRaw -> CertificateChainRaw -> Bool # | |
| Show CertificateChainRaw Source # | |
Defined in Data.X509.CertificateChain Methods showsPrec :: Int -> CertificateChainRaw -> ShowS # show :: CertificateChainRaw -> String # showList :: [CertificateChainRaw] -> ShowS # | |
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
| |
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 # | |
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) Source # | |
Defined in Data.X509.Signed Methods showsPrec :: Int -> SignedExact a -> ShowS # show :: SignedExact a -> String # showList :: [SignedExact a] -> ShowS # | |
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
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
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
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