Documentation ¶
Index ¶
Constants ¶
View Source
const (
//Magic number used for file signature/identification
Magic = "OCSEFF"
)
Variables ¶
View Source
var ( //ErrInvalidHeader invalid header ErrInvalidHeader = errors.New("invalid header") //ErrInvalidPublicKey invalid public key ErrInvalidPublicKey = errors.New("invalid public key") //ErrBadSignature bad signature ErrBadSignature = errors.New("bad signature") //ErrBadCertificate bad certificate ErrBadCertificate = errors.New("bad certificate") //ErrNoMatchingCertificates no matching certificates ErrNoMatchingCertificates = errors.New("no matching certificates") )
View Source
var ( //ErrInvalidAlgo invalid algorithm ErrInvalidAlgo = errors.New("invalid algorithm") )
Functions ¶
Types ¶
type Header ¶
type Header struct { Version uint8 `msgpack:"v"` Algo Algorithm `msgpack:"a"` CertificateID []byte `msgpack:"c"` Signature []byte `msgpack:"s"` IntendedCertificateID []byte `msgpack:"i"` EphemeralAlgo cki.Algorithm `msgpack:"ea"` EphemeralPublicKey []byte `msgpack:"ek"` EphemeralKDFSalt []byte `msgpack:"es"` Certificates [][]byte `msgpack:"ac,omitempty"` // contains filtered or unexported fields }
Header representation of a OCS EPF Header
func NewHeader ¶
func NewHeader(sigCert, intendedCert *cki.Certificate) (*Header, cki.PrivateKey, error)
NewHeader creates a new header and ephemeral key using a designated signing key (from) and an intended recipient key (to)
func NewHeaderWithOptions ¶
func NewHeaderWithOptions(sigCert, intendedCert *cki.Certificate, options ...HeaderOption) (*Header, error)
NewHeaderWithOptions creates a new header with a specific set of options applied using a designated signing key (from) and an intended recipient key (to)
func ParseHeader ¶
ParseHeader unmarshals in a msgpack encoded header
type HeaderOption ¶
HeaderOption header creation option
func WithEmbeddedCerts ¶
func WithEmbeddedCerts(c ...*cki.Certificate) HeaderOption
WithEmbeddedCerts specifies which certificates to include in the header certificates are parsed to ensure validity
func WithEncryptionAlgo ¶
func WithEncryptionAlgo(a Algorithm) HeaderOption
WithEncryptionAlgo specifies which encryption (AEAD) algorithm to use
func WithEphemeral ¶
func WithEphemeral(a cki.Algorithm) (cki.PrivateKey, HeaderOption, error)
WithEphemeral creates a new ephemeral key pair based off the given algorithm
Click to show internal directories.
Click to hide internal directories.