cryptostore-0.3.0.1: Serialization of cryptographic data types

License | BSD-style
Maintainer | Olivier Chéron <olivier.cheron@gmail.com>
Stability | experimental
Portability | unknown
Safe Haskell | Safe-Inferred
Language | Haskell2010

Crypto.Store.X509

Contents

- Public keys
- Signed objects
- Reading and writing PEM files

Description

Public keys, certificates and CRLs.

Presents an API similar to Data.X509.Memory and Data.X509.File but provides support for public-key files and allows to write objects.

Functions related to private keys are available from Crypto.Store.PKCS8.

Synopsis

- class (ASN1Object a, Eq a, Show a) => SignedObject a
- readPubKeyFile :: FilePath -> IO [PubKey]
- readPubKeyFileFromMemory :: ByteString -> [PubKey]
- pemToPubKey :: [Maybe PubKey] -> PEM -> [Maybe PubKey]
- writePubKeyFile :: FilePath -> [PubKey] -> IO ()
- writePubKeyFileToMemory :: [PubKey] -> ByteString
- pubKeyToPEM :: PubKey -> PEM
- readSignedObject :: SignedObject a => FilePath -> IO [SignedExact a]
- readSignedObjectFromMemory :: SignedObject a => ByteString -> [SignedExact a]
- writeSignedObject :: SignedObject a => FilePath -> [SignedExact a] -> IO ()
- writeSignedObjectToMemory :: SignedObject a => [SignedExact a] -> ByteString
- readPEMs :: FilePath -> IO [PEM]
- writePEMs :: FilePath -> [PEM] -> IO ()

# Documentation

class (ASN1Object a, Eq a, Show a) => SignedObject a Source #

Class of signed objects convertible to PEM.

Minimal complete definition

signedObjectName, otherObjectNames

#### Instances

Instances details

SignedObject CRL Source # |
Instance details Defined in Crypto.Store.X509 Methods signedObjectName :: proxy CRL -> String otherObjectNames :: proxy CRL -> [String]
SignedObject Certificate Source # |
Instance details Defined in Crypto.Store.X509 Methods signedObjectName :: proxy Certificate -> String otherObjectNames :: proxy Certificate -> [String]

# Public keys

readPubKeyFile :: FilePath -> IO [PubKey] Source #

Read public keys from a PEM file.

readPubKeyFileFromMemory :: ByteString -> [PubKey] Source #

Read public keys from a bytearray in PEM format.

pemToPubKey :: [Maybe PubKey] -> PEM -> [Maybe PubKey] Source #

Read a public key from a `PEM` element and add it to the accumulator list.

writePubKeyFile :: FilePath -> [PubKey] -> IO () Source #

Write public keys to a PEM file.

writePubKeyFileToMemory :: [PubKey] -> ByteString Source #

Write public keys to a bytearray in PEM format.

pubKeyToPEM :: PubKey -> PEM Source #

Generate a PEM for a public key.

# Signed objects

readSignedObject :: SignedObject a => FilePath -> IO [SignedExact a] Source #

Read signed objects from a PEM file (only one type at a time).

readSignedObjectFromMemory :: SignedObject a => ByteString -> [SignedExact a] Source #

Read signed objects from a bytearray in PEM format (only one type at a time).

writeSignedObject :: SignedObject a => FilePath -> [SignedExact a] -> IO () Source #

Write signed objects to a PEM file.

writeSignedObjectToMemory :: SignedObject a => [SignedExact a] -> ByteString Source #

Write signed objects to a bytearray in PEM format.

# Reading and writing PEM files

readPEMs :: FilePath -> IO [PEM] Source #

Read a PEM file from disk.

writePEMs :: FilePath -> [PEM] -> IO () Source #

Write a PEM file to disk.