github.com/emmansun/gmsm@v0.29.1/pkcs/cipher_des.go (about) 1 package pkcs 2 3 import ( 4 "crypto/des" 5 "encoding/asn1" 6 ) 7 8 var ( 9 oidDESCBC = asn1.ObjectIdentifier{1, 3, 14, 3, 2, 7} 10 oidDESEDE3CBC = asn1.ObjectIdentifier{1, 2, 840, 113549, 3, 7} 11 ) 12 13 func init() { 14 RegisterCipher(oidDESCBC, func() Cipher { 15 return DESCBC 16 }) 17 18 RegisterCipher(oidDESEDE3CBC, func() Cipher { 19 return TripleDESCBC 20 }) 21 } 22 23 var DESCBC = &cbcBlockCipher{ 24 baseBlockCipher: baseBlockCipher{ 25 keySize: 8, 26 newBlock: des.NewCipher, 27 oid: oidDESCBC, 28 }, 29 ivSize: des.BlockSize, 30 } 31 32 // TripleDESCBC is the 168-bit key 3DES cipher in CBC mode. 33 var TripleDESCBC = &cbcBlockCipher{ 34 baseBlockCipher: baseBlockCipher{ 35 keySize: 24, 36 newBlock: des.NewTripleDESCipher, 37 oid: oidDESEDE3CBC, 38 }, 39 ivSize: des.BlockSize, 40 }