andviro / pkcs7

Implements a subset of PKCS#7/Cryptographic Message Syntax (rfc2315, rfc5652) with stream signing and verifying

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pkcs7

This is a fork of an excellent pkcs7 package. Copyright (c) 2015 Andrew Smith.

Notable additions to the original library are stream verifying and signing functions. To verify signed message from reader src while writing contents to some writer dest use:

p7 := pkcs7.NewDecoder(r)
if err := p7.VerifyTo(dest); err != nil {
    // handle error
}
// use p7 fields and methods

To sign file src with known size to writer dest:

p7 := pkcs7.NewEncoder(dest)
if err := p7.AddSigner(cert.Certificate, cert.PrivateKey, SignerInfoConfig{}); err != nil {
    // handle add signer error
}
if err = p7.SignFrom(r, size); err != nil {
    // handle write error
}

GoDoc

Original README

GoDoc Build Status

pkcs7 implements parsing and creating signed and enveloped messages.

About

Implements a subset of PKCS#7/Cryptographic Message Syntax (rfc2315, rfc5652) with stream signing and verifying

License:MIT License


Languages

Language:Go 100.0%