cms

package
v0.0.0-...-3f58f9a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 21, 2018 License: MIT, MIT Imports: 9 Imported by: 0

Documentation

Overview

Package cms contains high level functions for cryptographic message syntax RFC 5652.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddTimestamps

func AddTimestamps(sd *protocol.SignedData, url string) (err error)

AddTimestamps adds a timestamp to the SignedData using the RFC3161 timestamping service at the given URL. This timestamp proves that the signed message existed the time of generation, allowing verifiers to have more trust in old messages signed with revoked keys.

Types

type CMS

type CMS struct {
	Intermediate               *x509.CertPool
	Opts                       x509.VerifyOptions
	ContentEncryptionAlgorithm asn1.ObjectIdentifier
	TimeStampServer            string
	TimeStamp                  bool
	// contains filtered or unexported fields
}

CMS is an instance of cms to en-/decrypt and sign/verfiy CMS data with the given keyPairs and options.

func New

func New(cert ...tls.Certificate) (cms *CMS, err error)

New create a new instance of CMS with given keyPairs.

func (*CMS) AddAttribute

func (cms *CMS) AddAttribute(attrType asn1.ObjectIdentifier, val interface{}) (err error)

AddAttribute adds a attribute to signedAttrs which will be used for signing

func (*CMS) AuthDecrypt

func (cms *CMS) AuthDecrypt(contentInfo []byte) (plain []byte, err error)

AuthDecrypt AEAD-decrypts DER-encoded ASN.1 ContentInfo and returns plaintext.

func (*CMS) AuthEncrypt

func (cms *CMS) AuthEncrypt(data []byte, recipients []*x509.Certificate) (der []byte, err error)

AuthEncrypt AEAD-encrypts data for the recipients and returns DER-encoded ASN.1 ContentInfo.

func (*CMS) Decrypt

func (cms *CMS) Decrypt(contentInfo []byte) (plain []byte, err error)

Decrypt decrypts DER-encoded ASN.1 ContentInfo and returns plaintext.

func (*CMS) Encrypt

func (cms *CMS) Encrypt(data []byte, recipients []*x509.Certificate) (der []byte, err error)

Encrypt encrypts data for the recipients and returns DER-encoded ASN.1 ContentInfo.

func (*CMS) Sign

func (cms *CMS) Sign(data []byte, detachedSignature ...bool) (der []byte, err error)

Sign signs the data and returns returns DER-encoded ASN.1 ContentInfo.

func (*CMS) Verify

func (cms *CMS) Verify(contentInfo []byte) (chains [][][]*x509.Certificate, err error)

Verify verifies the signature in contentInfo and returns returns DER-encoded ASN.1 ContentInfo.

func (*CMS) VerifyDetached

func (cms *CMS) VerifyDetached(contentInfo, msg []byte) (chains [][][]*x509.Certificate, err error)

VerifyDetached verifies the detached signature of msg in contentInfo and returns returns DER-encoded ASN.1 ContentInfo.

Directories

Path Synopsis
Package protocol implemets parts of cryptographic message syntax RFC 5652.
Package protocol implemets parts of cryptographic message syntax RFC 5652.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL