Versions in this module Expand all Collapse all v2 v2.3.3 Oct 19, 2023 Changes in this version + const CKK_SM2 + const CKK_SM3 + const CKK_VENDOR_DEFINED + const CKM_AES_XTS + const CKM_SHA_160_SM2 + const CKM_SHA_160_SM2_DER + const CKM_SHA_256_SM2 + const CKM_SHA_256_SM2_DER + const CKM_SM2 + const CKM_SM2_CIPHER_DER + const CKM_SM2_KEY_PAIR_GEN + const CKM_SM2_RAW + const CKM_SM2_RAW_DER + const CKM_SM2_SHA1 + const CKM_SM2_SHA1_DER + const CKM_SM2_SHA_160 + const CKM_SM2_SHA_256 + const CKM_SM2_SIGN + const CKM_SM2_SIGN_NO_DER + const CKM_SM3 + const CKM_SM3_HASH + const CKM_SM3_HASH_JIT + const CKM_SM3_SM2 + const CKM_SM3_SM2_APPID1 + const CKM_SM3_SM2_APPID1_DER + const CKM_SM3_SM2_DER + const CKM_SM3_SM2_Z + const CKM_SM3_SM2_Z_DER + const CKM_SM4 + const CKM_SM4_CBC + const CKM_SM4_CBC_PAD + const CKM_SM4_CTR + const CKM_SM4_ECB + const CKM_SM4_ECB_PAD + const CKM_SM4_KEY_GEN + const CKM_SM4_XTS + const CKM_VENDOR_DEFINED + func GenKeyPair(p11 *P11Handle, keyId string, keyType bccrypto.KeyType, opts *GenOpts) (bccrypto.PrivateKey, error) + func GenSecretKey(p11 *P11Handle, keyId string, keyType bccrypto.KeyType, keySize int) (bccrypto.SymmetricKey, error) + func GenerateBytesOTP(p11 *P11Handle, length int) ([]byte, error) + func GenerateOTP(p11 *P11Handle, length int) (string, error) + func NewAESKey(ctx *P11Handle, keyId []byte) (bccrypto.SymmetricKey, error) + func NewP11ECDSAPrivateKey(p11 *P11Handle, keyId []byte, keyType P11KeyType) (bccrypto.PrivateKey, error) + func NewP11RSAPrivateKey(p11 *P11Handle, keyId []byte, keyType P11KeyType) (bccrypto.PrivateKey, error) + func NewPrivateKey(p11 *P11Handle, keyId string, keyType bccrypto.KeyType) (bccrypto.PrivateKey, error) + func NewSM4Key(ctx *P11Handle, keyId []byte) (bccrypto.SymmetricKey, error) + func NewSecretKey(p11 *P11Handle, keyId string, keyType bccrypto.KeyType) (bccrypto.SymmetricKey, error) + type GenOpts struct + CurveParams string + KeyBits int + type P11Handle struct + func New(lib string, label string, password string, sessionCacheSize int, hash string) (*P11Handle, error) + func (p11 *P11Handle) Decrypt(obj pkcs11.ObjectHandle, mech *pkcs11.Mechanism, cipher []byte) ([]byte, error) + func (p11 *P11Handle) Encrypt(obj pkcs11.ObjectHandle, mech *pkcs11.Mechanism, plain []byte) ([]byte, error) + func (p11 *P11Handle) ExportECDSAPublicKey(id []byte, keyType P11KeyType) (interface{}, error) + func (p11 *P11Handle) ExportRSAPublicKey(id []byte) (*rsa.PublicKey, error) + func (p11 *P11Handle) GenKeyPair(mech *pkcs11.Mechanism, privAttrs, pubAttrs []*pkcs11.Attribute) (pri, pub *pkcs11.ObjectHandle, err error) + func (p11 *P11Handle) GenerateKey(mech *pkcs11.Mechanism, attrs []*pkcs11.Attribute) (*pkcs11.ObjectHandle, error) + func (p11 *P11Handle) GenerateRandom(length int) ([]byte, error) + func (p11 *P11Handle) GetPublicKeySKI(pk bccrypto.PublicKey) ([]byte, error) + func (p11 *P11Handle) Sign(obj pkcs11.ObjectHandle, mech *pkcs11.Mechanism, msg []byte) ([]byte, error) + func (p11 *P11Handle) Verify(obj pkcs11.ObjectHandle, mech *pkcs11.Mechanism, msg, sig []byte) error + type P11KeyType string + const AES + const ECDSA + const RSA + const SM2 + const SM4 + const UNKNOWN