| Safe Haskell | Safe-Infered |
|---|
OpenSSL.PEM
Contents
Description
An interface to PEM routines.
- type PemPasswordCallback = Int -> PemPasswordRWState -> IO String
- data PemPasswordRWState
- data PemPasswordSupply
- = PwNone
- | PwStr String
- | PwBS ByteString
- | PwCallback PemPasswordCallback
- | PwTTY
- 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 StringSource
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
PemPasswordRWStatePemPasswordCallback.
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"
Constructors
| 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
Arguments
| :: 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 SomeKeyPairSource
reads a private key in PEM string.
readPrivateKey pem supply
Public key
writePublicKey :: PublicKey key => key -> IO StringSource
writes a public to PEM string.
writePublicKey pubkey
readPublicKey :: String -> IO SomePublicKeySource
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
Constructors
| ReqNewFormat | The new format, whose header is "NEW CERTIFICATE REQUEST". |
| ReqOldFormat | The old format, whose header is "CERTIFICATE REQUEST". |
Arguments
| :: X509Req | request |
| -> PemX509ReqFormat | format |
| -> IO String | the result PEM string |
writes a PKCS#10 certificate request to PEM
string.
writeX509Req
readX509Req :: String -> IO X509ReqSource
reads a PKCS#10 certificate request in PEM string.
readX509Req
Certificate Revocation List
PKCS#7 structure
writePkcs7 :: Pkcs7 -> IO StringSource
writes a PKCS#7 structure to PEM string.
writePkcs7 p7
DH parameters
writeDHParams :: DHP -> IO StringSource
writes DH parameters to PEM string.
writeDHParams dh
readDHParams :: String -> IO DHPSource
reads DH parameters in PEM string.
readDHParams pem