Documentation ¶
Overview ¶
nolint
nolint
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 ¶
Types ¶
type ECCSignature ¶
ECCSignature represents a ecc signature
type SDFHandle ¶
type SDFHandle struct {
// contains filtered or unexported fields
}
SDFHandle represents a sdf handle
func New ¶
New returns a HSM SDFHandle to provide go-sdf functionalities.
func (*SDFHandle) Decrypt ¶
Decrypt decrypt a cipher with a given mechanism.
func (*SDFHandle) ECCInternalSign ¶
ECCInternalSign 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) GenerateRandom ¶
GenerateRandom return a random bytes with fixed length
func (*SDFHandle) SymDecrypt ¶
func (h *SDFHandle) SymDecrypt(keyHandle base.SessionHandle, mode uint, iv []byte, cipher []byte) ([]byte, error)
SymDecrypt decrypt a cipher with a given mechanism.
type SDFKey ¶
type SDFKey struct { KeyId uint KeyPwd []byte KeyType SDFKeyType }
SDFKey represents a sdf key
type SDFKeyType ¶
type SDFKeyType string
SDFKeyType defines sdf key type
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.