Documentation ¶
Overview ¶
Package cms contains high level functions for cryptographic message syntax RFC 5652.
Index ¶
- func AddTimestamps(sd *protocol.SignedData, url string) (err error)
- type CMS
- func (cms *CMS) AddAttribute(attrType asn1.ObjectIdentifier, val interface{}) (err error)
- func (cms *CMS) AuthDecrypt(contentInfo []byte) (plain []byte, err error)
- func (cms *CMS) AuthEncrypt(data []byte, recipients []*x509.Certificate) (der []byte, err error)
- func (cms *CMS) Decrypt(contentInfo []byte) (plain []byte, err error)
- func (cms *CMS) Encrypt(data []byte, recipients []*x509.Certificate) (der []byte, err error)
- func (cms *CMS) Sign(data []byte, detachedSignature ...bool) (der []byte, err error)
- func (cms *CMS) Verify(contentInfo []byte) (chains [][][]*x509.Certificate, err error)
- func (cms *CMS) VerifyDetached(contentInfo, msg []byte) (chains [][][]*x509.Certificate, err error)
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 ¶
AuthDecrypt AEAD-decrypts DER-encoded ASN.1 ContentInfo and returns plaintext.
func (*CMS) AuthEncrypt ¶
AuthEncrypt AEAD-encrypts data for the recipients and returns DER-encoded ASN.1 ContentInfo.
func (*CMS) Encrypt ¶
Encrypt encrypts data for the recipients and 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.