Documentation ¶
Overview ¶
Package pkcs implements ciphers used by PKCS#7 & PKCS#8.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AES128CBC = &cbcBlockCipher{ baseBlockCipher: baseBlockCipher{ keySize: 16, newBlock: aes.NewCipher, oid: oidAES128CBC, }, ivSize: aes.BlockSize, }
AES128CBC is the 128-bit key AES cipher in CBC mode.
var AES128GCM = &gcmBlockCipher{ baseBlockCipher: baseBlockCipher{ keySize: 16, newBlock: aes.NewCipher, oid: oidAES128GCM, }, nonceSize: 12, }
AES128GCM is the 128-bit key AES cipher in GCM mode.
var AES192CBC = &cbcBlockCipher{ baseBlockCipher: baseBlockCipher{ keySize: 24, newBlock: aes.NewCipher, oid: oidAES192CBC, }, ivSize: aes.BlockSize, }
AES192CBC is the 192-bit key AES cipher in CBC mode.
var AES192GCM = &gcmBlockCipher{ baseBlockCipher: baseBlockCipher{ keySize: 24, newBlock: aes.NewCipher, oid: oidAES192GCM, }, nonceSize: 12, }
AES192GCM is the 912-bit key AES cipher in GCM mode.
var AES256CBC = &cbcBlockCipher{ baseBlockCipher: baseBlockCipher{ keySize: 32, newBlock: aes.NewCipher, oid: oidAES256CBC, }, ivSize: aes.BlockSize, }
AES256CBC is the 256-bit key AES cipher in CBC mode.
var AES256GCM = &gcmBlockCipher{ baseBlockCipher: baseBlockCipher{ keySize: 32, newBlock: aes.NewCipher, oid: oidAES256GCM, }, nonceSize: 12, }
AES256GCM is the 256-bit key AES cipher in GCM mode.
var DESCBC = &cbcBlockCipher{ baseBlockCipher: baseBlockCipher{ keySize: 8, newBlock: des.NewCipher, oid: oidDESCBC, }, ivSize: des.BlockSize, }
var SM4CBC = &cbcBlockCipher{ baseBlockCipher: baseBlockCipher{ keySize: 16, newBlock: sm4.NewCipher, oid: oidSM4CBC, }, ivSize: sm4.BlockSize, }
SM4CBC is the 128-bit key SM4 cipher in CBC mode.
var SM4ECB = &ecbBlockCipher{ baseBlockCipher: baseBlockCipher{ keySize: 16, newBlock: sm4.NewCipher, oid: oidSM4ECB, }, }
SM4ECB is the 128-bit key SM4 cipher in ECB mode.
var SM4GCM = &gcmBlockCipher{ baseBlockCipher: baseBlockCipher{ keySize: 16, newBlock: sm4.NewCipher, oid: oidSM4GCM, }, nonceSize: 12, }
SM4GCM is the 128-bit key SM4 cipher in GCM mode.
var TripleDESCBC = &cbcBlockCipher{ baseBlockCipher: baseBlockCipher{ keySize: 24, newBlock: des.NewTripleDESCipher, oid: oidDESEDE3CBC, }, ivSize: des.BlockSize, }
TripleDESCBC is the 168-bit key 3DES cipher in CBC mode.
Functions ¶
func RegisterCipher ¶
func RegisterCipher(oid asn1.ObjectIdentifier, cipher func() Cipher)
RegisterCipher registers a function that returns a new instance of the given cipher. This allows the library to support client-provided ciphers.
Types ¶
type Cipher ¶
type Cipher interface { // KeySize returns the key size of the cipher, in bytes. KeySize() int // Encrypt encrypts the key material. Encrypt(key, plaintext []byte) (*pkix.AlgorithmIdentifier, []byte, error) // Decrypt decrypts the key material. Decrypt(key []byte, parameters *asn1.RawValue, encryptedKey []byte) ([]byte, error) // OID returns the OID of the cipher specified. OID() asn1.ObjectIdentifier }
Cipher represents a cipher for encrypting the key material.