Documentation ¶
Index ¶
- Constants
- func CCharArrToGoSlice(buf []C.uchar) []byte
- func NewPrivateKey(sdf *SDFHandle, keyId string, keyPwd []byte, tp bccrypto.KeyType) (bccrypto.PrivateKey, error)
- func NewSecretKey(sdf *SDFHandle, keyId string, keyPwd []byte, tp bccrypto.KeyType) (bccrypto.SymmetricKey, error)
- type ECCSignature
- type SDFHandle
- func (h *SDFHandle) Close() error
- func (h *SDFHandle) Decrypt(key SDFKey, cipher []byte) ([]byte, error)
- func (h *SDFHandle) ECCInternalSign(key SDFKey, msg []byte) ([]byte, error)
- func (h *SDFHandle) Encrypt(key SDFKey, plain []byte) ([]byte, error)
- func (h *SDFHandle) ExportECDSAPublicKey(key SDFKey) (interface{}, error)
- func (h *SDFHandle) GenKeyPair() (pri *base.ECCrefPrivateKey, pub *base.ECCrefPublicKey, err error)
- func (h *SDFHandle) GenerateKey(length int) ([]byte, error)
- func (h *SDFHandle) GenerateRandom(length int) ([]byte, error)
- func (h *SDFHandle) SymDecrypt(keyHandle base.SessionHandle, mode uint, iv []byte, cipher []byte) ([]byte, error)
- func (h *SDFHandle) SymEncrypt(keyHandle base.SessionHandle, mode uint, iv []byte, plain []byte) ([]byte, error)
- func (h *SDFHandle) Verify(key SDFKey, msg []byte, sig base.ECCSignature) error
- type SDFKey
- type SDFKeyType
Constants ¶
View Source
const ( BLOCK_MODE_ECB = "ECB" BLOCK_MODE_CTR = "CTR" )
Variables ¶
This section is empty.
Functions ¶
func NewPrivateKey ¶
Types ¶
type SDFHandle ¶
type SDFHandle struct {
// contains filtered or unexported fields
}
func New ¶
New returns a HSM SDFHandle to provide go-sdf functionalities.
func (*SDFHandle) Decrypt ¶
Encrypt encrypts a plaintext with a given mechanism.
func (*SDFHandle) ECCInternalSign ¶
Sign signs the input with a given mechanism.
func (*SDFHandle) Encrypt ¶
Encrypt encrypts a plaintext with a given mechanism.
func (*SDFHandle) ExportECDSAPublicKey ¶
ExportECDSAPublicKey export a ecdsa/sm2 public key of pkcs11 ecdsa/sm2 private key
func (*SDFHandle) GenKeyPair ¶
func (h *SDFHandle) GenKeyPair() (pri *base.ECCrefPrivateKey, pub *base.ECCrefPublicKey, err error)
GenKeyPair returns asym keypair
func (*SDFHandle) GenerateKey ¶
GenerateKey returns sym key
func (*SDFHandle) SymDecrypt ¶
func (h *SDFHandle) SymDecrypt(keyHandle base.SessionHandle, mode uint, iv []byte, cipher []byte) ([]byte, error)
Encrypt encrypts a plaintext with a given mechanism.
type SDFKey ¶
type SDFKey struct { KeyId uint KeyPwd []byte KeyType SDFKeyType }
type SDFKeyType ¶
type SDFKeyType string
const ( RSA SDFKeyType = "RSA" ECDSA SDFKeyType = "ECDSA" SM2 SDFKeyType = "SM2" AES SDFKeyType = "AES" SM4 SDFKeyType = "SM4" UNKNOWN SDFKeyType = "UNKNOWN" )
Source Files ¶
Click to show internal directories.
Click to hide internal directories.