pkcs7: support older CFCA integration #225

This commit is contained in:
Sun Yimin 2024-06-11 11:01:05 +08:00 committed by GitHub
parent 23081971e8
commit 4db3046001
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View File

@ -53,3 +53,13 @@ var SM4GCM = &gcmBlockCipher{
}, },
nonceSize: 12, nonceSize: 12,
} }
// SM4 is the 128-bit key SM4 cipher in CBC mode, it's just for CFCA.
var SM4 = &cbcBlockCipher{
baseBlockCipher: baseBlockCipher{
keySize: 16,
newBlock: sm4.NewCipher,
oid: oidSM4,
},
ivSize: sm4.BlockSize,
}

View File

@ -93,6 +93,7 @@ func TestEncryptSM(t *testing.T) {
func TestEncryptCFCA(t *testing.T) { func TestEncryptCFCA(t *testing.T) {
ciphers := []pkcs.Cipher{ ciphers := []pkcs.Cipher{
pkcs.SM4,
pkcs.SM4CBC, pkcs.SM4CBC,
pkcs.SM4GCM, pkcs.SM4GCM,
} }