smime

package
v0.0.0-...-857e2ed Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package smime implants parts of the S/MIME 4.0 specification rfc5751-bis-12.

See https://www.ietf.org/id/draft-ietf-lamps-rfc5751-bis-12.txt

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Header struct {
	Key   string
	Value string
}

Header field for creating signed or encrypted messages.

type SMIME

type SMIME struct {
	CMS *cms.CMS
}

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

func New

func New(keyPair ...tls.Certificate) (smime *SMIME, err error)

New create a new instance of SMIME with given keyPairs.

func (*SMIME) AuthEncrypt

func (smime *SMIME) AuthEncrypt(msg []byte, recipients []*x509.Certificate, opts ...Header) (smimemsg []byte, err error)

AuthEncrypt authenticated-encrypts msg for the recipients and returns SMIME message.

func (*SMIME) Decrypt

func (smime *SMIME) Decrypt(msg []byte) (plaintext []byte, err error)

Decrypt decrypts SMIME message and returns plaintext.

func (*SMIME) Encrypt

func (smime *SMIME) Encrypt(msg []byte, recipients []*x509.Certificate, opts ...Header) (smimemsg []byte, err error)

Encrypt encrypts msg for the recipients and returns SMIME message.

func (*SMIME) Sign

func (smime *SMIME) Sign(msg []byte) (signedMsg []byte, err error)

Sign signs a mail and returns the signed message.

func (*SMIME) Verify

func (smime *SMIME) Verify(msg []byte) (chains [][][]*x509.Certificate, err error)

Verify verifies a signed mail and returns certificate chains of the signers if the signature is valid.

Jump to

Keyboard shortcuts

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