Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
An interface to PEM routines.
Synopsis
- type PemPasswordCallback = Int -> PemPasswordRWState -> IO String
- data PemPasswordRWState
- data PemPasswordSupply
- writePKCS8PrivateKey :: KeyPair key => key -> Maybe (Cipher, PemPasswordSupply) -> IO String
- readPrivateKey :: String -> PemPasswordSupply -> IO SomeKeyPair
- writePublicKey :: PublicKey key => key -> IO String
- readPublicKey :: String -> IO SomePublicKey
- writeX509 :: X509 -> IO String
- readX509 :: String -> IO X509
- data PemX509ReqFormat
- writeX509Req :: X509Req -> PemX509ReqFormat -> IO String
- readX509Req :: String -> IO X509Req
- writeCRL :: CRL -> IO String
- readCRL :: String -> IO CRL
- writePkcs7 :: Pkcs7 -> IO String
- readPkcs7 :: String -> IO Pkcs7
- writeDHParams :: DHP -> IO String
- readDHParams :: String -> IO DHP
Password supply
type PemPasswordCallback = Int -> PemPasswordRWState -> IO String Source #
represents a callback function to supply a
password.PemPasswordCallback
Int
- The maximum length of the password to be accepted.
PemPasswordRWState
- The context.
IO String
- The resulting password.
data PemPasswordRWState Source #
represents a context of
PemPasswordRWState
PemPasswordCallback
.
data PemPasswordSupply Source #
represents a way to supply password.PemPasswordSupply
FIXME: using PwTTY causes an error but I don't know why: "error:0906406D:PEM routines:DEF_CALLBACK:problems getting password"
PwNone | no password |
PwStr String | password in a static string |
PwBS ByteString | password in a static bytestring. |
PwCallback PemPasswordCallback | get a password by a callback |
PwTTY | read a password from TTY |
Private key
:: KeyPair key | |
=> key | private key to write |
-> Maybe (Cipher, PemPasswordSupply) | Either (symmetric cipher
algorithm, password
supply) or |
-> IO String | the result PEM string |
writes a private key to PEM string in
PKCS#8 format.writePKCS8PrivateKey
readPrivateKey :: String -> PemPasswordSupply -> IO SomeKeyPair Source #
reads a private key in PEM string.readPrivateKey
pem supply
Public key
writePublicKey :: PublicKey key => key -> IO String Source #
writes a public to PEM string.writePublicKey
pubkey
readPublicKey :: String -> IO SomePublicKey Source #
reads a public key in PEM string.readPublicKey
pem
X.509 certificate
PKCS#10 certificate request
data PemX509ReqFormat Source #
represents format of PKCS#10 certificate
request.PemX509ReqFormat
ReqNewFormat | The new format, whose header is "NEW CERTIFICATE REQUEST". |
ReqOldFormat | The old format, whose header is "CERTIFICATE REQUEST". |
:: X509Req | request |
-> PemX509ReqFormat | format |
-> IO String | the result PEM string |
writes a PKCS#10 certificate request to PEM
string.writeX509Req
readX509Req :: String -> IO X509Req Source #
reads a PKCS#10 certificate request in PEM string.readX509Req
Certificate Revocation List
writeCRL :: CRL -> IO String Source #
writes a Certificate Revocation List to PEM
string.writeCRL
crl
PKCS#7 structure
writePkcs7 :: Pkcs7 -> IO String Source #
writes a PKCS#7 structure to PEM string.writePkcs7
p7
DH parameters
writeDHParams :: DHP -> IO String Source #
writes DH parameters to PEM string.writeDHParams
dh
readDHParams :: String -> IO DHP Source #
reads DH parameters in PEM string.readDHParams
pem