-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Certificates and Key Reader/Writer -- -- Certificates and Key reader/writer -- -- At the moment only X509 certificate and unencrypted private key are -- supported, but will include PGP certificate and pkcs8 private keys @package certificate @version 0.9.0 -- | Read/Write Private RSA Key module Data.Certificate.KeyRSA data Private Private :: Int -> Int -> Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> Private version :: Private -> Int lenmodulus :: Private -> Int modulus :: Private -> Integer public_exponant :: Private -> Integer private_exponant :: Private -> Integer p1 :: Private -> Integer p2 :: Private -> Integer exp1 :: Private -> Integer exp2 :: Private -> Integer coef :: Private -> Integer decodePrivate :: ByteString -> Either String Private encodePrivate :: Private -> ByteString -- | Read/Write Private Key module Data.Certificate.KeyDSA data Private Private :: Int -> Integer -> Integer -> Integer -> Integer -> Integer -> Private version :: Private -> Int priv :: Private -> Integer pub :: Private -> Integer p :: Private -> Integer q :: Private -> Integer g :: Private -> Integer decodePrivate :: ByteString -> Either String Private encodePrivate :: Private -> ByteString -- | Read PEM files module Data.Certificate.PEM parsePEMCert :: ByteString -> Maybe ByteString parsePEMCertReq :: ByteString -> Maybe ByteString parsePEMKey :: ByteString -> Maybe ByteString parsePEMKeyRSA :: ByteString -> Maybe ByteString parsePEMKeyDSA :: ByteString -> Maybe ByteString parsePEMs :: ByteString -> [PEM] findPEM :: String -> [PEM] -> Maybe ByteString module Data.Certificate.X509Cert data SignatureALG SignatureALG_md5WithRSAEncryption :: SignatureALG SignatureALG_md2WithRSAEncryption :: SignatureALG SignatureALG_sha1WithRSAEncryption :: SignatureALG SignatureALG_dsaWithSHA1 :: SignatureALG SignatureALG_ecdsaWithSHA384 :: SignatureALG SignatureALG_Unknown :: OID -> SignatureALG data PubKeyALG PubKeyALG_RSA :: PubKeyALG PubKeyALG_DSA :: PubKeyALG PubKeyALG_ECDSA :: PubKeyALG PubKeyALG_DH :: PubKeyALG PubKeyALG_Unknown :: OID -> PubKeyALG data PubKey -- | RSA format with (len modulus, modulus, e) PubKeyRSA :: (Int, Integer, Integer) -> PubKey -- | DSA format with (pub, p, q, g) PubKeyDSA :: (Integer, Integer, Integer, Integer) -> PubKey -- | DH format with (p,g,q,j,(seed,pgenCounter)) PubKeyDH :: (Integer, Integer, Integer, Maybe Integer, ([Word8], Integer)) -> PubKey -- | ECDSA format not done yet FIXME PubKeyECDSA :: [ASN1] -> PubKey -- | unrecognized format PubKeyUnknown :: OID -> [Word8] -> PubKey data ASN1StringType UTF8 :: ASN1StringType Printable :: ASN1StringType Univ :: ASN1StringType BMP :: ASN1StringType IA5 :: ASN1StringType T61 :: ASN1StringType type ASN1String = (ASN1StringType, String) data Certificate Certificate :: Int -> Integer -> SignatureALG -> [(OID, ASN1String)] -> [(OID, ASN1String)] -> (Time, Time) -> PubKey -> Maybe CertificateExts -> Certificate -- | Certificate Version certVersion :: Certificate -> Int -- | Certificate Serial number certSerial :: Certificate -> Integer -- | Certificate Signature algorithm certSignatureAlg :: Certificate -> SignatureALG -- | Certificate Issuer DN certIssuerDN :: Certificate -> [(OID, ASN1String)] -- | Certificate Subject DN certSubjectDN :: Certificate -> [(OID, ASN1String)] -- | Certificate Validity period certValidity :: Certificate -> (Time, Time) -- | Certificate Public key certPubKey :: Certificate -> PubKey -- | Certificate Extensions certExtensions :: Certificate -> Maybe CertificateExts data CertificateExts CertificateExts :: Maybe (Bool, [CertKeyUsage]) -> Maybe (Bool, Bool) -> Maybe (Bool, [Word8]) -> Maybe (Bool) -> [(OID, Bool, [ASN1])] -> CertificateExts certExtKeyUsage :: CertificateExts -> Maybe (Bool, [CertKeyUsage]) certExtBasicConstraints :: CertificateExts -> Maybe (Bool, Bool) certExtSubjectKeyIdentifier :: CertificateExts -> Maybe (Bool, [Word8]) certExtPolicies :: CertificateExts -> Maybe (Bool) certExtOthers :: CertificateExts -> [(OID, Bool, [ASN1])] oidCommonName :: OID oidCountry :: OID oidOrganization :: OID oidOrganizationUnit :: OID oidSig :: OID -> SignatureALG sigOID :: SignatureALG -> OID -- | parse header structure of a x509 certificate. the structure the -- following: Version Serial Number Algorithm ID Issuer Validity Not -- Before Not After Subject Subject Public Key Info Public Key Algorithm -- Subject Public Key Issuer Unique Identifier (Optional) (>= 2) -- Subject Unique Identifier (Optional) (>= 2) Extensions (Optional) -- (>= v3) parseCertificate :: ParseASN1 Certificate encodeCertificateHeader :: Certificate -> [ASN1] instance Show SignatureALG instance Eq SignatureALG instance Show PubKeyALG instance Eq PubKeyALG instance Show PubKey instance Eq PubKey instance Show CertKeyUsage instance Eq CertKeyUsage instance Show ASN1StringType instance Eq ASN1StringType instance Show CertificateExts instance Eq CertificateExts instance Show Certificate instance Eq Certificate -- | Read/Write X509 certificate module Data.Certificate.X509 data X509 X509 :: Certificate -> (Maybe ByteString) -> (Maybe ByteString) -> SignatureALG -> [Word8] -> X509 data SignatureALG SignatureALG_md5WithRSAEncryption :: SignatureALG SignatureALG_md2WithRSAEncryption :: SignatureALG SignatureALG_sha1WithRSAEncryption :: SignatureALG SignatureALG_dsaWithSHA1 :: SignatureALG SignatureALG_ecdsaWithSHA384 :: SignatureALG SignatureALG_Unknown :: OID -> SignatureALG data PubKeyALG PubKeyALG_RSA :: PubKeyALG PubKeyALG_DSA :: PubKeyALG PubKeyALG_ECDSA :: PubKeyALG PubKeyALG_DH :: PubKeyALG PubKeyALG_Unknown :: OID -> PubKeyALG data PubKey -- | RSA format with (len modulus, modulus, e) PubKeyRSA :: (Int, Integer, Integer) -> PubKey -- | DSA format with (pub, p, q, g) PubKeyDSA :: (Integer, Integer, Integer, Integer) -> PubKey -- | DH format with (p,g,q,j,(seed,pgenCounter)) PubKeyDH :: (Integer, Integer, Integer, Maybe Integer, ([Word8], Integer)) -> PubKey -- | ECDSA format not done yet FIXME PubKeyECDSA :: [ASN1] -> PubKey -- | unrecognized format PubKeyUnknown :: OID -> [Word8] -> PubKey data ASN1StringType UTF8 :: ASN1StringType Printable :: ASN1StringType Univ :: ASN1StringType BMP :: ASN1StringType IA5 :: ASN1StringType T61 :: ASN1StringType type ASN1String = (ASN1StringType, String) data Certificate Certificate :: Int -> Integer -> SignatureALG -> [(OID, ASN1String)] -> [(OID, ASN1String)] -> (Time, Time) -> PubKey -> Maybe CertificateExts -> Certificate -- | Certificate Version certVersion :: Certificate -> Int -- | Certificate Serial number certSerial :: Certificate -> Integer -- | Certificate Signature algorithm certSignatureAlg :: Certificate -> SignatureALG -- | Certificate Issuer DN certIssuerDN :: Certificate -> [(OID, ASN1String)] -- | Certificate Subject DN certSubjectDN :: Certificate -> [(OID, ASN1String)] -- | Certificate Validity period certValidity :: Certificate -> (Time, Time) -- | Certificate Public key certPubKey :: Certificate -> PubKey -- | Certificate Extensions certExtensions :: Certificate -> Maybe CertificateExts data CertificateExts CertificateExts :: Maybe (Bool, [CertKeyUsage]) -> Maybe (Bool, Bool) -> Maybe (Bool, [Word8]) -> Maybe (Bool) -> [(OID, Bool, [ASN1])] -> CertificateExts certExtKeyUsage :: CertificateExts -> Maybe (Bool, [CertKeyUsage]) certExtBasicConstraints :: CertificateExts -> Maybe (Bool, Bool) certExtSubjectKeyIdentifier :: CertificateExts -> Maybe (Bool, [Word8]) certExtPolicies :: CertificateExts -> Maybe (Bool) certExtOthers :: CertificateExts -> [(OID, Bool, [ASN1])] -- | get signing data related to a X509 message, - which is either the -- cached data or the encoded certificate getSigningData :: X509 -> ByteString -- | decode an X509 from a bytestring - the structure is the following: - -- Certificate - Certificate Signature Algorithm - Certificate Signature decodeCertificate :: ByteString -> Either String X509 -- | encode a X509 certificate to a bytestring encodeCertificate :: X509 -> ByteString instance Show X509 instance Eq X509 module System.Certificate.X509 findCertificate :: (X509 -> Bool) -> IO (Maybe X509)