Skip to content

Commit

Permalink
pkcs7: support older CFCA integration #225
Browse files Browse the repository at this point in the history
  • Loading branch information
emmansun authored Jun 11, 2024
1 parent 2308197 commit 4db3046
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkcs/cipher_sm4.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,13 @@ var SM4GCM = &gcmBlockCipher{
},
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,
}
1 change: 1 addition & 0 deletions pkcs7/encrypt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func TestEncryptSM(t *testing.T) {

func TestEncryptCFCA(t *testing.T) {
ciphers := []pkcs.Cipher{
pkcs.SM4,
pkcs.SM4CBC,
pkcs.SM4GCM,
}
Expand Down

0 comments on commit 4db3046

Please sign in to comment.