oid

package
v0.0.0-...-81b2598 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2022 License: MIT, MIT Imports: 14 Imported by: 0

Documentation

Overview

Package oid contains OIDs that are used by other packages in this repository.

Index

Constants

This section is empty.

Variables

View Source
var (
	Data               = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 7, 1}
	SignedData         = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 7, 2}
	EnvelopedData      = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 7, 3}
	AuthEnvelopedData  = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 9, 16, 1, 23}
	TSTInfo            = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 9, 16, 1, 4}
	ContentTypeTSTInfo = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 9, 16, 1, 4}
)

Content type OIDs

View Source
var (
	AttributeContentType    = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 9, 3}
	AttributeMessageDigest  = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 9, 4}
	AttributeSigningTime    = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 9, 5}
	AttributeTimeStampToken = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 9, 16, 2, 14}
)

Attribute OIDs

View Source
var (
	SignatureAlgorithmRSA             = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 1}
	SignatureAlgorithmRSASSAPSS       = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 10}
	SignatureAlgorithmECDSA           = asn1.ObjectIdentifier{1, 2, 840, 10045, 2, 1}
	SignatureAlgorithmECDSAwithSHA1   = asn1.ObjectIdentifier{1, 2, 840, 10045, 4, 1}
	SignatureAlgorithmECDSAwithSHA224 = asn1.ObjectIdentifier{1, 2, 840, 10045, 4, 3, 1}
	SignatureAlgorithmECDSAwithSHA256 = asn1.ObjectIdentifier{1, 2, 840, 10045, 4, 3, 2}
	SignatureAlgorithmECDSAwithSHA384 = asn1.ObjectIdentifier{1, 2, 840, 10045, 4, 3, 3}
	SignatureAlgorithmECDSAwithSHA512 = asn1.ObjectIdentifier{1, 2, 840, 10045, 4, 3, 4}
)

Signature Algorithm OIDs

View Source
var (
	EncryptionAlgorithmRSA       = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 1}
	EncryptionAlgorithmRSAESOAEP = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 7}
)

Public Key Encryption OIDs

View Source
var (
	DigestAlgorithmSHA1   = asn1.ObjectIdentifier{1, 3, 14, 3, 2, 26}
	DigestAlgorithmMD5    = asn1.ObjectIdentifier{1, 2, 840, 113549, 2, 5}
	DigestAlgorithmSHA256 = asn1.ObjectIdentifier{2, 16, 840, 1, 101, 3, 4, 2, 1}
	DigestAlgorithmSHA384 = asn1.ObjectIdentifier{2, 16, 840, 1, 101, 3, 4, 2, 2}
	DigestAlgorithmSHA512 = asn1.ObjectIdentifier{2, 16, 840, 1, 101, 3, 4, 2, 3}
)

Digest Algorithm OIDs

View Source
var (
	DHSinglePassstdDHsha1kdfscheme   = asn1.ObjectIdentifier{1, 3, 133, 16, 840, 63, 0, 2}
	DHSinglePassstdDHsha224kdfscheme = asn1.ObjectIdentifier{1, 3, 132, 1, 11, 0}
	DHSinglePassstdDHsha256kdfscheme = asn1.ObjectIdentifier{1, 3, 132, 1, 11, 1}
	DHSinglePassstdDHsha384kdfscheme = asn1.ObjectIdentifier{1, 3, 132, 1, 11, 2}
	DHSinglePassstdDHsha512kdfscheme = asn1.ObjectIdentifier{1, 3, 132, 1, 11, 3}
)

DH Key Derivation Schemes OIDs

View Source
var (
	AES128Wrap = asn1.ObjectIdentifier{2, 16, 840, 1, 101, 3, 4, 1, 5}
	AES192Wrap = asn1.ObjectIdentifier{2, 16, 840, 1, 101, 3, 4, 1, 25}
	AES256Wrap = asn1.ObjectIdentifier{2, 16, 840, 1, 101, 3, 4, 1, 45}
)

Key wrap algorithm OIDs

View Source
var (
	EncryptionAlgorithmDESCBC     = asn1.ObjectIdentifier{1, 3, 14, 3, 2, 7}
	EncryptionAlgorithmDESEDE3CBC = asn1.ObjectIdentifier{1, 2, 840, 113549, 3, 7}
	EncryptionAlgorithmAES128CBC  = asn1.ObjectIdentifier{2, 16, 840, 1, 101, 3, 4, 1, 2}
	EncryptionAlgorithmAES256CBC  = asn1.ObjectIdentifier{2, 16, 840, 1, 101, 3, 4, 1, 42}
	//AEAD
	EncryptionAlgorithmAES128GCM = asn1.ObjectIdentifier{2, 16, 840, 1, 101, 3, 4, 1, 6}
	AEADChaCha20Poly1305         = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 9, 16, 3, 18}
)

Encryption Algorithm OIDs

DigestAlgorithmToHash maps digest OIDs to crypto.Hash values.

View Source
var (
	ECPublicKey = asn1.ObjectIdentifier{1, 2, 840, 10045, 2, 1}
)

Elliptic curve public key OID

HashToDigestAlgorithm maps crypto.Hash values to digest OIDs.

KDFHashAlgorithm key derivation schemes to its hash algorithms

View Source
var PublicKeyAlgorithmToEncrytionAlgorithm = map[x509.PublicKeyAlgorithm]pkix.AlgorithmIdentifier{
	x509.RSA: pkix.AlgorithmIdentifier{Algorithm: EncryptionAlgorithmRSA},
}

PublicKeyAlgorithmToEncrytionAlgorithm maps certificate public key algorithms to CMS encryption algorithms.

PublicKeyAlgorithmToSignatureAlgorithm maps certificate public key algorithms to CMS signature algorithms.

SignatureAlgorithmToDigestAlgorithm maps x509.SignatureAlgorithm to digestAlgorithm OIDs.

SignatureAlgorithmToSignatureAlgorithm maps x509.SignatureAlgorithm to signatureAlgorithm OIDs.

SignatureAlgorithms maps digest and signature OIDs to x509.SignatureAlgorithm values.

View Source
var (
	SubjectKeyIdentifier = asn1.ObjectIdentifier{2, 5, 29, 14}
)

X.509 extensions

View Source
var SymmetricKeyLen = map[string]int{
	EncryptionAlgorithmDESCBC.String():     8,
	EncryptionAlgorithmDESEDE3CBC.String(): 24,
	EncryptionAlgorithmAES128CBC.String():  16,
	EncryptionAlgorithmAES256CBC.String():  32,

	EncryptionAlgorithmAES128GCM.String(): 16,
	AEADChaCha20Poly1305.String():         32,
}

SymmetricKeyLen maps the encryption algorithm to its key length

Functions

func Unwrap

func Unwrap(block cipher.Block, encKey []byte) (cek []byte, err error)

Unwrap decrypts the provided encrypted key (encKey) with the given AES cipher (block), using the AES Key Wrap algorithm (RFC-3394). Returns an error if validation fails.

func Wrap

func Wrap(block cipher.Block, cek []byte) (encKey []byte, err error)

Wrap encrypts the content encryption key (cek) with the given AES cipher (block), using the AES Key Wrap algorithm (RFC-3394)

Types

type EncryptionAlgorithm

type EncryptionAlgorithm struct {
	EncryptionAlgorithmIdentifier        asn1.ObjectIdentifier
	ContentEncryptionAlgorithmIdentifier pkix.AlgorithmIdentifier
	Key, IV, MAC                         []byte
}

EncryptionAlgorithm does the handling of the encrypton and decryption for a given algorithm identifier.

func (*EncryptionAlgorithm) Decrypt

func (e *EncryptionAlgorithm) Decrypt(ciphertext []byte) (plaintext []byte, err error)

Decrypt decrypts the ciphertext and returns the plaintext.

func (*EncryptionAlgorithm) Encrypt

func (e *EncryptionAlgorithm) Encrypt(plaintext []byte) (ciphertext []byte, err error)

Encrypt encrypts the plaintext and returns the ciphertext.

type KeyWrap

type KeyWrap struct {
	KEK              []byte
	KeyWrapAlgorithm asn1.ObjectIdentifier
}

KeyWrap wraps and unwraps key with the key encrytion key (KEK) for a given (KeyWrapAlgorithm)

func (*KeyWrap) AlgorithmIdentifier

func (kw *KeyWrap) AlgorithmIdentifier() (algID pkix.AlgorithmIdentifier)

AlgorithmIdentifier returns the OID of the key wrap algorithm

func (*KeyWrap) KeyLen

func (kw *KeyWrap) KeyLen() (len int)

KeyLen returns the key lenght of the key wrap algorithm

func (*KeyWrap) UnWrap

func (kw *KeyWrap) UnWrap(encKey []byte) (cek []byte, err error)

UnWrap unwraps the encrypted key (encKey)

func (*KeyWrap) Wrap

func (kw *KeyWrap) Wrap(cek []byte) (ciphertext []byte, err error)

Wrap wraps the content encryption key (cek)

Jump to

Keyboard shortcuts

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