The pkcs10 package

[ Tags: apache, data, library ] [ Propose Tags ]

Please see README.md


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.1.0.4, 0.1.0.5, 0.1.1.0, 0.2.0.0
Dependencies asn1-encoding, asn1-parse, asn1-types, base (>=4.3 && <5), bytestring, cryptonite, pem, x509 [details]
License Apache-2.0
Copyright Timothy Klim <hackage@timothyklim.com>
Author Timothy Klim <hackage@timothyklim.com>
Maintainer Timothy Klim <hackage@timothyklim.com>
Category Data
Home page https://github.com/fcomb/pkcs10-hs#readme
Source repository head: git clone git://github.com/fcomb/pkcs10-hs
Uploaded Wed Nov 2 09:36:02 UTC 2016 by ktimothy
Distributions LTSHaskell:0.2.0.0, NixOS:0.2.0.0, Stackage:0.2.0.0, Tumbleweed:0.2.0.0
Downloads 607 total (11 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2016-11-18 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for pkcs10-0.2.0.0

[back to package description]

PKCS#10 library

Build Status

Example

import           Crypto.Hash
import           Crypto.PubKey.RSA
import           Data.X509
import           Data.X509.PKCS10

main :: IO ()
main = do
  let rsaKeySize = 128
  let publicExponent = 3
  (pubKey, privKey) <- generate rsaKeySize publicExponent
  let subjectAttrs = makeX520Attributes [(X520CommonName, "node.fcomb.io"), (X520OrganizationName, "fcomb")]
  let extAttrs = PKCS9Attributes [PKCS9Attribute $ ExtBasicConstraints False Nothing, PKCS9Attribute $ ExtKeyUsage [KeyUsage_digitalSignature,KeyUsage_nonRepudiation,KeyUsage_keyEncipherment]]
  Right req <- generateCSR subjectAttrs extAttrs (KeyPairRSA pubKey privKey) SHA512
  putStrLn . show . toPEM $ req -- export in PEM format
  putStrLn . show $ verify (csrToSigned req) $ PubKeyRSA pubKey -- sign CSR before verifying