| 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
- = PubKeyRSA PublicKey
- | PubKeyRSAPSS PublicKey (Maybe PSSParams)
- | PubKeyDSA PublicKey
- | PubKeyDH PubKeyDH
- | PubKeyEC PubKeyEC
- | PubKeyX25519 PublicKey
- | PubKeyX448 PublicKey
- | PubKeyEd25519 PublicKey
- | PubKeyEd448 PublicKey
- | PubKeyMLDSA44 (VerificationKey MLDSA44)
- | PubKeyMLDSA65 (VerificationKey MLDSA65)
- | PubKeyMLDSA87 (VerificationKey MLDSA87)
- | PubKeyMLKEM512 (EncapsulationKey MLKEM512)
- | PubKeyMLKEM768 (EncapsulationKey MLKEM768)
- | PubKeyMLKEM1024 (EncapsulationKey MLKEM1024)
- | PubKeyUnknown OID ByteString
- data PubKeyEC
- = PubKeyEC_Prime { }
- | PubKeyEC_Named { }
- data PubKeyDH
- dhPublicKey :: Integer -> Integer -> Integer -> Integer -> PubKeyDH
- pubkeyDH_p :: PubKeyDH -> Integer
- pubkeyDH_g :: PubKeyDH -> Integer
- pubkeyDH_q :: PubKeyDH -> Integer
- pubkeyDH_j :: PubKeyDH -> Maybe Integer
- pubkeyDH_validation :: PubKeyDH -> Maybe (BitArray, Integer)
- pubkeyDH_y :: PubKeyDH -> Integer
- newtype SerializedPoint = SerializedPoint ByteString
- data PrivKey
- = PrivKeyRSA PrivateKey
- | PrivKeyRSAPSS PrivateKey (Maybe PSSParams)
- | PrivKeyDSA PrivateKey
- | PrivKeyEC PrivKeyEC
- | PrivKeyX25519 SecretKey
- | PrivKeyX448 SecretKey
- | PrivKeyEd25519 SecretKey
- | PrivKeyEd448 SecretKey
- | PrivKeyMLDSA44 (PrivKeyMLDSA MLDSA44)
- | PrivKeyMLDSA65 (PrivKeyMLDSA MLDSA65)
- | PrivKeyMLDSA87 (PrivKeyMLDSA MLDSA87)
- | PrivKeyMLKEM512 (PrivKeyMLKEM MLKEM512)
- | PrivKeyMLKEM768 (PrivKeyMLKEM MLKEM768)
- | PrivKeyMLKEM1024 (PrivKeyMLKEM MLKEM1024)
- data PrivKeyEC
- = PrivKeyEC_Prime { }
- | PrivKeyEC_Named { }
- data PrivKeyMLDSA p
- data MLKeyForm
- type MLDSAKeyForm = MLKeyForm
- pattern MLDSAKeySeed :: MLKeyForm
- pattern MLDSAKeyExpanded :: MLKeyForm
- pattern MLDSAKeyBoth :: MLKeyForm
- privkeyMLDSAFromSeed :: (MLDSA p, ByteArrayAccess ba) => proxy p -> MLKeyForm -> ba -> CryptoFailable (PrivKeyMLDSA p)
- privkeyMLDSAFromKey :: SigningKey p -> PrivKeyMLDSA p
- privkeyMLDSA_key :: PrivKeyMLDSA p -> SigningKey p
- privkeyMLDSA_seed :: PrivKeyMLDSA p -> Maybe ScrubbedBytes
- privkeyMLDSA_form :: PrivKeyMLDSA p -> MLKeyForm
- data PrivKeyMLKEM p
- privkeyMLKEMFromSeed :: (MLKEM p, ByteArrayAccess ba) => proxy p -> MLKeyForm -> ba -> CryptoFailable (PrivKeyMLKEM p)
- privkeyMLKEMFromKey :: DecapsulationKey p -> PrivKeyMLKEM p
- privkeyMLKEM_key :: PrivKeyMLKEM p -> DecapsulationKey p
- privkeyMLKEM_seed :: PrivKeyMLKEM p -> Maybe ScrubbedBytes
- privkeyMLKEM_form :: PrivKeyMLKEM p -> MLKeyForm
- pubkeyToAlg :: PubKey -> PubKeyALG
- privkeyToAlg :: PrivKey -> PubKeyALG
- data PSSParams
- defaultPSSParams :: HashALG -> PSSParams
- data HashALG
- data PubKeyALG
- data SignatureALG
- rsaPSSSignatureALG :: PSSParams -> SignatureALG
- signatureALGPSSParams :: SignatureALG -> Maybe PSSParams
- 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
- data ExtExtendedKeyUsage = ExtExtendedKeyUsage [ExtKeyUsagePurpose]
- data ExtKeyUsagePurpose
- data ExtSubjectKeyId = ExtSubjectKeyId ByteString
- data ExtSubjectAltName = ExtSubjectAltName [AltName]
- data ExtAuthorityKeyId where
- pattern ExtAuthorityKeyId :: ByteString -> ExtAuthorityKeyId
- defaultExtAuthorityKeyId :: ExtAuthorityKeyId
- data ExtCrlDistributionPoints = ExtCrlDistributionPoints [DistributionPoint]
- data ExtNetscapeComment = ExtNetscapeComment ByteString
- data ExtNameConstraints = ExtNameConstraints [GeneralSubtree] [GeneralSubtree]
- data GeneralSubtree = GeneralSubtree AltName Integer (Maybe Integer)
- data AltName
- data DistributionPoint
- defaultDistributionPoint :: DistributionPoint
- data DistributionPointName
- data ReasonFlag
- extensionGet :: Extension a => Extensions -> Maybe a
- extensionGetE :: Extension a => Extensions -> Maybe (Either String a)
- extensionDecode :: Extension a => ExtensionRaw -> Maybe (Either String a)
- extensionEncode :: Extension a => Bool -> a -> ExtensionRaw
- recognizedOIDs :: [OID]
- data ExtensionRaw = ExtensionRaw {}
- tryExtRawASN1 :: ExtensionRaw -> Either String [ASN1]
- extRawASN1 :: ExtensionRaw -> [ASN1]
- newtype Extensions = Extensions (Maybe [ExtensionRaw])
- data CRL = CRL {}
- data RevokedCertificate = RevokedCertificate {}
- data DistinguishedName where
- pattern DistinguishedName :: [(OID, ASN1CharacterString)] -> DistinguishedName
- type RelativeDistinguishedName = [(OID, ASN1CharacterString)]
- getRDNs :: DistinguishedName -> [RelativeDistinguishedName]
- fromRDNs :: [RelativeDistinguishedName] -> DistinguishedName
- data DnElement
- data ASN1CharacterString = ASN1CharacterString {}
- getDnElement :: DnElement -> DistinguishedName -> Maybe ASN1CharacterString
- canonicalDistinguishedName :: DistinguishedName -> DistinguishedName
- 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 {}
- 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
| Show Certificate Source # | |
Defined in Data.X509.Cert Methods showsPrec :: Int -> Certificate -> ShowS # show :: Certificate -> String # showList :: [Certificate] -> ShowS # | |
| ASN1Object Certificate Source # | |
Defined in Data.X509.Cert | |
| Eq Certificate Source # | |
Defined in Data.X509.Cert | |
Public key types known and used in X.509
Constructors
| PubKeyRSA PublicKey | RSA public key |
| PubKeyRSAPSS PublicKey (Maybe PSSParams) | RSASSA-PSS public key, restricted to the parameters if any |
| PubKeyDSA PublicKey | DSA public key |
| PubKeyDH PubKeyDH | X9.42 DH public key |
| 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 |
| PubKeyMLDSA44 (VerificationKey MLDSA44) | ML-DSA-44 public key |
| PubKeyMLDSA65 (VerificationKey MLDSA65) | ML-DSA-65 public key |
| PubKeyMLDSA87 (VerificationKey MLDSA87) | ML-DSA-87 public key |
| PubKeyMLKEM512 (EncapsulationKey MLKEM512) | ML-KEM-512 public key |
| PubKeyMLKEM768 (EncapsulationKey MLKEM768) | ML-KEM-768 public key |
| PubKeyMLKEM1024 (EncapsulationKey MLKEM1024) | ML-KEM-1024 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
X9.42 Diffie-Hellman public key (RFC 3279 2.3.3). The constructor is
hidden; use dhPublicKey and record update syntax.
Instances
dhPublicKey :: Integer -> Integer -> Integer -> Integer -> PubKeyDH Source #
A DH public key from p, g, q and the public value, without j and validation parameters.
pubkeyDH_p :: PubKeyDH -> Integer Source #
the prime
pubkeyDH_g :: PubKeyDH -> Integer Source #
the generator
pubkeyDH_q :: PubKeyDH -> Integer Source #
the prime factor of p-1
pubkeyDH_y :: PubKeyDH -> Integer Source #
the public value
newtype SerializedPoint Source #
Serialized Elliptic Curve Point
Constructors
| SerializedPoint ByteString |
Instances
| Show SerializedPoint Source # | |
Defined in Data.X509.PublicKey Methods showsPrec :: Int -> SerializedPoint -> ShowS # show :: SerializedPoint -> String # showList :: [SerializedPoint] -> ShowS # | |
| Eq SerializedPoint Source # | |
Defined in Data.X509.PublicKey Methods (==) :: SerializedPoint -> SerializedPoint -> Bool # (/=) :: SerializedPoint -> SerializedPoint -> Bool # | |
Private key types known and used in X.509
Constructors
| PrivKeyRSA PrivateKey | RSA private key |
| PrivKeyRSAPSS PrivateKey (Maybe PSSParams) | RSASSA-PSS private key, restricted to the parameters if any |
| 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 |
| PrivKeyMLDSA44 (PrivKeyMLDSA MLDSA44) | ML-DSA-44 private key |
| PrivKeyMLDSA65 (PrivKeyMLDSA MLDSA65) | ML-DSA-65 private key |
| PrivKeyMLDSA87 (PrivKeyMLDSA MLDSA87) | ML-DSA-87 private key |
| PrivKeyMLKEM512 (PrivKeyMLKEM MLKEM512) | ML-KEM-512 private key |
| PrivKeyMLKEM768 (PrivKeyMLKEM MLKEM768) | ML-KEM-768 private key |
| PrivKeyMLKEM1024 (PrivKeyMLKEM MLKEM1024) | ML-KEM-1024 private key |
Instances
| Show PrivKey Source # | |
| DebugShow PrivKey Source # | Rendering a private key with the key material in it, for the times when
that is what is meant. Each arm is |
Defined in Data.X509.PrivateKey | |
| ASN1Object PrivKey Source # | |
| Eq PrivKey Source # | |
Elliptic Curve Private Key
TODO: missing support for binary curve.
Constructors
| PrivKeyEC_Prime | |
| PrivKeyEC_Named | |
Fields | |
data PrivKeyMLDSA p Source #
An ML-DSA private key.
RFC 9881 Section 6 writes one as the seed it was derived from, as the expanded key, or as both, and which of the three it was is part of the key here. A key read from a file is therefore written back out as the same thing it came in as, rather than as whichever form this module happens to prefer.
The expanded key is there whatever the form: a seed is expanded as it is
read, so privkeyMLDSA_key always answers. The seed is not, since a
key written as expandedKey does not carry one; privkeyMLDSA_seed is
a Maybe for that reason, and a key whose seed was never on the wire
cannot be given one back -- crypton's
Crypto.PubKey.MLDSA.generateKeyPairAndSeed is where a seed that is to
be kept has to be caught.
The constructors are not exported: a seed and an expanded key that do
not belong together would be a key that signs with one and claims the
other, so the only ways in are privkeyMLDSAFromSeed, which expands the
seed itself, and privkeyMLDSAFromKey, which has no seed to disagree
with.
Two keys are equal when they hold the same thing in the same form: the same key as a seed and as an expanded key are two different files, and the encoding round trip says so.
Instances
| Show (PrivKeyMLDSA p) Source # | The form is shown; neither the seed nor the key is. Use
|
Defined in Data.X509.PrivateKey Methods showsPrec :: Int -> PrivKeyMLDSA p -> ShowS # show :: PrivKeyMLDSA p -> String # showList :: [PrivKeyMLDSA p] -> ShowS # | |
| DebugShow (PrivKeyMLDSA p) Source # | |
Defined in Data.X509.PrivateKey Methods debugShow :: PrivKeyMLDSA p -> String # | |
| Eq (PrivKeyMLDSA p) Source # | |
Defined in Data.X509.PrivateKey Methods (==) :: PrivKeyMLDSA p -> PrivKeyMLDSA p -> Bool # (/=) :: PrivKeyMLDSA p -> PrivKeyMLDSA p -> Bool # | |
Which of the three forms of an ML-DSA (RFC 9881 Section 6) or ML-KEM (RFC 9935 Section 6) private key a key was read as, and is written back out as.
Constructors
| MLKeySeed | The seed alone, |
| MLKeyExpanded | The expanded key alone, |
| MLKeyBoth | Both together, |
type MLDSAKeyForm = MLKeyForm Source #
Deprecated: Use MLKeyForm
The former name of MLKeyForm.
pattern MLDSAKeySeed :: MLKeyForm Source #
Deprecated: Use MLKeySeed
The former name of MLKeySeed.
pattern MLDSAKeyExpanded :: MLKeyForm Source #
Deprecated: Use MLKeyExpanded
The former name of MLKeyExpanded.
pattern MLDSAKeyBoth :: MLKeyForm Source #
Deprecated: Use MLKeyBoth
The former name of MLKeyBoth.
privkeyMLDSAFromSeed :: (MLDSA p, ByteArrayAccess ba) => proxy p -> MLKeyForm -> ba -> CryptoFailable (PrivKeyMLDSA p) Source #
Build a key from its seed, to be written back out in the given form.
The expanded key is derived here, so it cannot fail to be the one the
seed belongs to. Passing MLKeyExpanded throws the seed away, which
is the way to turn a seed into a key that will be written without one.
privkeyMLDSAFromKey :: SigningKey p -> PrivKeyMLDSA p Source #
Build a key from the expanded key alone, which is what a key that was generated without keeping its seed has to be.
privkeyMLDSA_key :: PrivKeyMLDSA p -> SigningKey p Source #
The expanded key, whatever form the key is in.
privkeyMLDSA_seed :: PrivKeyMLDSA p -> Maybe ScrubbedBytes Source #
The seed, for a key that has one.
privkeyMLDSA_form :: PrivKeyMLDSA p -> MLKeyForm Source #
The form the key will be written out in.
data PrivKeyMLKEM p Source #
An ML-KEM private key, kept in the form it was read as, like
PrivKeyMLDSA. The constructors are not exported.
Instances
| MLKEM p => Show (PrivKeyMLKEM p) Source # | The form is shown; neither the seed nor the key is. |
Defined in Data.X509.PrivateKey Methods showsPrec :: Int -> PrivKeyMLKEM p -> ShowS # show :: PrivKeyMLKEM p -> String # showList :: [PrivKeyMLKEM p] -> ShowS # | |
| MLKEM p => DebugShow (PrivKeyMLKEM p) Source # | |
Defined in Data.X509.PrivateKey Methods debugShow :: PrivKeyMLKEM p -> String # | |
| MLKEM p => Eq (PrivKeyMLKEM p) Source # | |
Defined in Data.X509.PrivateKey Methods (==) :: PrivKeyMLKEM p -> PrivKeyMLKEM p -> Bool # (/=) :: PrivKeyMLKEM p -> PrivKeyMLKEM p -> Bool # | |
privkeyMLKEMFromSeed :: (MLKEM p, ByteArrayAccess ba) => proxy p -> MLKeyForm -> ba -> CryptoFailable (PrivKeyMLKEM p) Source #
Build a key from its seed, to be written back out in the given form.
privkeyMLKEMFromKey :: DecapsulationKey p -> PrivKeyMLKEM p Source #
Build a key from the expanded key alone.
privkeyMLKEM_key :: PrivKeyMLKEM p -> DecapsulationKey p Source #
The expanded key, whatever form the key is in.
privkeyMLKEM_seed :: PrivKeyMLKEM p -> Maybe ScrubbedBytes Source #
The seed, for a key that has one.
privkeyMLKEM_form :: PrivKeyMLKEM p -> MLKeyForm Source #
The form the key will be written out in.
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
RSASSA-PSS parameters (RFC 4055). Only MGF1 and the trailer field 1
are supported. The constructor is hidden; use defaultPSSParams and
record update syntax.
defaultPSSParams :: HashALG -> PSSParams Source #
The hash for both the message and MGF1, and the salt length equal to the hash length.
Hash Algorithm
Constructors
| HashMD2 | |
| HashMD5 | |
| HashSHA1 | |
| HashSHA224 | |
| HashSHA256 | |
| HashSHA384 | |
| HashSHA512 | |
| HashSHA3_224 | |
| HashSHA3_256 | |
| HashSHA3_384 | |
| HashSHA3_512 |
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_MLDSA44 | ML-DSA-44 signature algorithm (RFC 9881) |
| PubKeyALG_MLDSA65 | ML-DSA-65 signature algorithm (RFC 9881) |
| PubKeyALG_MLDSA87 | ML-DSA-87 signature algorithm (RFC 9881) |
| PubKeyALG_MLKEM512 | ML-KEM-512 key encapsulation (RFC 9935) |
| PubKeyALG_MLKEM768 | ML-KEM-768 key encapsulation (RFC 9935) |
| PubKeyALG_MLKEM1024 | ML-KEM-1024 key encapsulation (RFC 9935) |
| 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 | |
| SignatureALG_RSAPSS PSSParams | RSASSA-PSS with parameters other than |
Instances
| Show SignatureALG Source # | |
Defined in Data.X509.AlgorithmIdentifier Methods showsPrec :: Int -> SignatureALG -> ShowS # show :: SignatureALG -> String # showList :: [SignatureALG] -> ShowS # | |
| ASN1Object SignatureALG Source # | |
Defined in Data.X509.AlgorithmIdentifier | |
| Eq SignatureALG Source # | |
Defined in Data.X509.AlgorithmIdentifier | |
rsaPSSSignatureALG :: PSSParams -> SignatureALG Source #
The RSASSA-PSS signature algorithm with the given parameters.
signatureALGPSSParams :: SignatureALG -> Maybe PSSParams Source #
The RSASSA-PSS parameters of a signature algorithm, if any.
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 ExtBasicConstraints Source #
Basic Constraints
Constructors
| ExtBasicConstraints Bool (Maybe Integer) |
Instances
| Show ExtBasicConstraints Source # | |
Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtBasicConstraints -> ShowS # show :: ExtBasicConstraints -> String # showList :: [ExtBasicConstraints] -> ShowS # | |
| 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 # | |
data ExtKeyUsage Source #
Describe key usage
Constructors
| ExtKeyUsage [ExtKeyUsageFlag] |
Instances
| Show ExtKeyUsage Source # | |
Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtKeyUsage -> ShowS # show :: ExtKeyUsage -> String # showList :: [ExtKeyUsage] -> ShowS # | |
| 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 | |
data ExtKeyUsageFlag Source #
key usage flag that is found in the key usage extension field.
Constructors
Instances
data ExtExtendedKeyUsage Source #
Extended key usage extension
Constructors
| ExtExtendedKeyUsage [ExtKeyUsagePurpose] |
Instances
| Show ExtExtendedKeyUsage Source # | |
Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtExtendedKeyUsage -> ShowS # show :: ExtExtendedKeyUsage -> String # showList :: [ExtExtendedKeyUsage] -> ShowS # | |
| 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 # | |
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
| Show ExtKeyUsagePurpose Source # | |
Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtKeyUsagePurpose -> ShowS # show :: ExtKeyUsagePurpose -> String # showList :: [ExtKeyUsagePurpose] -> ShowS # | |
| 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 # | |
data ExtSubjectKeyId Source #
Provide a way to identify a public key by a short hash.
Constructors
| ExtSubjectKeyId ByteString |
Instances
| Show ExtSubjectKeyId Source # | |
Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtSubjectKeyId -> ShowS # show :: ExtSubjectKeyId -> String # showList :: [ExtSubjectKeyId] -> ShowS # | |
| 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 # | |
data ExtSubjectAltName Source #
Provide a way to supply alternate name that can be used for matching host name.
Constructors
| ExtSubjectAltName [AltName] |
Instances
data ExtAuthorityKeyId where Source #
Authority key identifier (RFC 5280 4.2.1.1). The constructor is
hidden; use defaultExtAuthorityKeyId and record update syntax.
Bundled Patterns
| pattern ExtAuthorityKeyId :: ByteString -> ExtAuthorityKeyId | An identifier with a keyIdentifier. Constructing sets only the keyIdentifier. |
Instances
| Show ExtAuthorityKeyId Source # | |
Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtAuthorityKeyId -> ShowS # show :: ExtAuthorityKeyId -> String # showList :: [ExtAuthorityKeyId] -> ShowS # | |
| 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 # | |
defaultExtAuthorityKeyId :: ExtAuthorityKeyId Source #
No fields.
data ExtCrlDistributionPoints Source #
Identify how CRL information is obtained
Constructors
| ExtCrlDistributionPoints [DistributionPoint] |
Instances
| Show ExtCrlDistributionPoints Source # | |
Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtCrlDistributionPoints -> ShowS # show :: ExtCrlDistributionPoints -> String # showList :: [ExtCrlDistributionPoints] -> ShowS # | |
| 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 # | |
data ExtNetscapeComment Source #
Constructors
| ExtNetscapeComment ByteString |
Instances
| Show ExtNetscapeComment Source # | |
Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtNetscapeComment -> ShowS # show :: ExtNetscapeComment -> String # showList :: [ExtNetscapeComment] -> ShowS # | |
| 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 # | |
data ExtNameConstraints Source #
Constructors
| ExtNameConstraints [GeneralSubtree] [GeneralSubtree] |
Instances
| Show ExtNameConstraints Source # | |
Defined in Data.X509.Ext Methods showsPrec :: Int -> ExtNameConstraints -> ShowS # show :: ExtNameConstraints -> String # showList :: [ExtNameConstraints] -> ShowS # | |
| Extension ExtNameConstraints Source # | |
Defined in Data.X509.Ext Methods extOID :: ExtNameConstraints -> OID Source # extHasNestedASN1 :: Proxy ExtNameConstraints -> Bool Source # extEncode :: ExtNameConstraints -> [ASN1] Source # extDecode :: [ASN1] -> Either String ExtNameConstraints Source # extDecodeBs :: ByteString -> Either String ExtNameConstraints Source # | |
| Eq ExtNameConstraints Source # | |
Defined in Data.X509.Ext Methods (==) :: ExtNameConstraints -> ExtNameConstraints -> Bool # (/=) :: ExtNameConstraints -> ExtNameConstraints -> Bool # | |
data GeneralSubtree Source #
Constructors
| GeneralSubtree AltName Integer (Maybe Integer) |
Instances
| Show GeneralSubtree Source # | |
Defined in Data.X509.Ext Methods showsPrec :: Int -> GeneralSubtree -> ShowS # show :: GeneralSubtree -> String # showList :: [GeneralSubtree] -> ShowS # | |
| Eq GeneralSubtree Source # | |
Defined in Data.X509.Ext Methods (==) :: GeneralSubtree -> GeneralSubtree -> Bool # (/=) :: GeneralSubtree -> GeneralSubtree -> Bool # | |
GeneralName (RFC 5280 4.2.1.6).
Constructors
| AltNameRFC822 String | |
| AltNameDNS String | |
| AltNameDN DistinguishedName | |
| AltNameURI String | |
| AltNameIP ByteString | |
| AltNameXMPP String | |
| AltNameDNSSRV String | |
| AltNameOther OID ByteString | otherName other than XMPP and SRV: the type and the DER encoding of the value |
| AltNameX400 ByteString | x400Address: the DER encoding of the ORAddress contents |
| AltNameEDIParty ByteString | ediPartyName: the DER encoding of the EDIPartyName contents |
| AltNameRegisteredID OID | registeredID |
data DistributionPoint Source #
Distribution point (RFC 5280 4.2.1.13). The constructor is hidden;
use defaultDistributionPoint and record update syntax.
Instances
| Show DistributionPoint Source # | |
Defined in Data.X509.Ext Methods showsPrec :: Int -> DistributionPoint -> ShowS # show :: DistributionPoint -> String # showList :: [DistributionPoint] -> ShowS # | |
| Eq DistributionPoint Source # | |
Defined in Data.X509.Ext Methods (==) :: DistributionPoint -> DistributionPoint -> Bool # (/=) :: DistributionPoint -> DistributionPoint -> Bool # | |
defaultDistributionPoint :: DistributionPoint Source #
No fields. A distribution point needs a name or a CRL issuer.
data DistributionPointName Source #
The name of a distribution point.
Constructors
| DistributionPointFullName [AltName] | |
| DistributionPointRelativeName RelativeDistinguishedName |
Instances
| Show DistributionPointName Source # | |
Defined in Data.X509.Ext Methods showsPrec :: Int -> DistributionPointName -> ShowS # show :: DistributionPointName -> String # showList :: [DistributionPointName] -> ShowS # | |
| Eq DistributionPointName Source # | |
Defined in Data.X509.Ext Methods (==) :: DistributionPointName -> DistributionPointName -> Bool # (/=) :: DistributionPointName -> DistributionPointName -> Bool # | |
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 # | |
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 # | |
| 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 # | |
extensionGet :: Extension a => Extensions -> Maybe a Source #
Get a specific extension from a lists of raw extensions
extensionGetE :: Extension a => Extensions -> Maybe (Either String a) Source #
Get a specific extension from a lists of raw extensions
extensionDecode :: Extension a => ExtensionRaw -> Maybe (Either String a) Source #
Try to decode an ExtensionRaw.
If this function return: * Nothing, the OID doesn't match * Just Left, the OID matched, but the extension couldn't be decoded * Just Right, the OID matched, and the extension has been succesfully decoded
extensionEncode :: Extension a => Bool -> a -> ExtensionRaw Source #
Encode an Extension to extensionRaw
recognizedOIDs :: [OID] Source #
data ExtensionRaw Source #
An undecoded extension
Constructors
| ExtensionRaw | |
Fields
| |
Instances
| Show ExtensionRaw Source # | |
Defined in Data.X509.ExtensionRaw Methods showsPrec :: Int -> ExtensionRaw -> ShowS # show :: ExtensionRaw -> String # showList :: [ExtensionRaw] -> ShowS # | |
| ASN1Object ExtensionRaw Source # | |
Defined in Data.X509.ExtensionRaw | |
| Eq ExtensionRaw Source # | |
Defined in Data.X509.ExtensionRaw | |
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
| Show Extensions Source # | |
Defined in Data.X509.ExtensionRaw Methods showsPrec :: Int -> Extensions -> ShowS # show :: Extensions -> String # showList :: [Extensions] -> ShowS # | |
| ASN1Object Extensions Source # | |
Defined in Data.X509.ExtensionRaw | |
| Eq Extensions Source # | |
Defined in Data.X509.ExtensionRaw | |
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
| Show RevokedCertificate Source # | |
Defined in Data.X509.CRL Methods showsPrec :: Int -> RevokedCertificate -> ShowS # show :: RevokedCertificate -> String # showList :: [RevokedCertificate] -> ShowS # | |
| ASN1Object RevokedCertificate Source # | |
Defined in Data.X509.CRL | |
| Eq RevokedCertificate Source # | |
Defined in Data.X509.CRL Methods (==) :: RevokedCertificate -> RevokedCertificate -> Bool # (/=) :: RevokedCertificate -> RevokedCertificate -> Bool # | |
Naming
data DistinguishedName where Source #
A sequence of relative distinguished names. The constructor is
hidden; use getRDNs and fromRDNs, or the DistinguishedName pattern
for names without multi-valued RDNs.
Bundled Patterns
| pattern DistinguishedName :: [(OID, ASN1CharacterString)] -> DistinguishedName | All attributes in order, flattening multi-valued RDNs. Constructing makes one RDN per attribute. |
Instances
type RelativeDistinguishedName = [(OID, ASN1CharacterString)] Source #
A set of attribute types and values, usually with one element.
getRDNs :: DistinguishedName -> [RelativeDistinguishedName] Source #
The relative distinguished names.
fromRDNs :: [RelativeDistinguishedName] -> DistinguishedName Source #
A name from relative distinguished names.
Elements commonly available in a DistinguishedName structure
Constructors
| DnCommonName | CN |
| DnCountry | Country |
| DnOrganization | O |
| DnOrganizationUnit | OU |
| DnEmailAddress | Email Address (legacy) |
| DnLocality | L |
| DnStateOrProvince | ST |
| DnStreetAddress | Street address |
| DnPostalCode | Postal code |
| DnSerialNumber | Serial number |
| DnTitle | Title |
| DnName | Name |
| DnSurname | Surname |
| DnGivenName | Given name |
| DnInitials | Initials |
| DnGenerationQualifier | Generation qualifier |
| DnQualifier | DN qualifier |
| DnPseudonym | Pseudonym |
| DnDomainComponent | DC |
| DnUserId | UID |
Instances
| Bounded DnElement Source # | |
| Enum DnElement Source # | |
Defined in Data.X509.DistinguishedName Methods succ :: DnElement -> DnElement # pred :: DnElement -> DnElement # fromEnum :: DnElement -> Int # enumFrom :: DnElement -> [DnElement] # enumFromThen :: DnElement -> DnElement -> [DnElement] # enumFromTo :: DnElement -> DnElement -> [DnElement] # enumFromThenTo :: DnElement -> DnElement -> DnElement -> [DnElement] # | |
| Show DnElement Source # | |
| OIDNameable DnElement Source # | |
Defined in Data.X509.DistinguishedName Methods fromObjectID :: OID -> Maybe DnElement # | |
| OIDable DnElement Source # | |
Defined in Data.X509.DistinguishedName Methods getObjectID :: DnElement -> OID # | |
| Eq DnElement Source # | |
data ASN1CharacterString #
ASN1 Character String with encoding
Constructors
| ASN1CharacterString | |
Instances
getDnElement :: DnElement -> DistinguishedName -> Maybe ASN1CharacterString Source #
Try to get a specific element in a DistinguishedName structure
canonicalDistinguishedName :: DistinguishedName -> DistinguishedName Source #
A form for comparing names (RFC 5280 7.1): string values are converted to UTF8String, lower-cased and whitespace is folded, and the attributes of each RDN are sorted. Values that cannot be decoded are kept.
Certificate Chain
newtype CertificateChain Source #
A chain of X.509 certificates in exact form.
Constructors
| CertificateChain [SignedExact Certificate] |
Instances
| Show CertificateChain Source # | |
Defined in Data.X509.CertificateChain Methods showsPrec :: Int -> CertificateChain -> ShowS # show :: CertificateChain -> String # showList :: [CertificateChain] -> ShowS # | |
| Eq CertificateChain Source # | |
Defined in Data.X509.CertificateChain Methods (==) :: CertificateChain -> CertificateChain -> Bool # (/=) :: CertificateChain -> CertificateChain -> Bool # | |
newtype CertificateChainRaw Source #
Represent a chain of X.509 certificates in bytestring form.
Constructors
| CertificateChainRaw [ByteString] |
Instances
| Show CertificateChainRaw Source # | |
Defined in Data.X509.CertificateChain Methods showsPrec :: Int -> CertificateChainRaw -> ShowS # show :: CertificateChainRaw -> String # showList :: [CertificateChainRaw] -> ShowS # | |
| Eq CertificateChainRaw Source # | |
Defined in Data.X509.CertificateChain Methods (==) :: CertificateChainRaw -> CertificateChainRaw -> Bool # (/=) :: CertificateChainRaw -> CertificateChainRaw -> Bool # | |
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
| |
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) => Show (SignedExact a) Source # | |
Defined in Data.X509.Signed Methods showsPrec :: Int -> SignedExact a -> ShowS # show :: SignedExact a -> String # showList :: [SignedExact a] -> ShowS # | |
| (Show a, Eq a, ASN1Object a) => Eq (SignedExact a) Source # | |
Defined in Data.X509.Signed Methods (==) :: SignedExact a -> SignedExact a -> Bool # (/=) :: SignedExact a -> SignedExact a -> Bool # | |
getSigned :: SignedExact a -> Signed a Source #
get the decoded Signed data
getSignedData :: (Show a, Eq a, ASN1Object a) => SignedExact a -> ByteString Source #
Get the signed data for the signature
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