sdf

package module
v0.0.0-...-9a701f4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

README

SDF

This project is an cryptographic project about the Hardware Security Module(HSM). Particularly,these functions in the project are conforming to standard specifications GM/T 0018 2012. this project is not finished yet.Please look forward to some days later.

Test

Prerequisite software in environment

  • gcc

Documentation

Overview

Package sdf Copyright Hyperledger All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	SDR_OK   = 0x00000000
	SDR_BASE = 0x01000000
)
View Source
const (
	SGD_TRUE      = 0x00000001
	SGD_FALSE     = 0x00000000
	SGD_SM1_ECB   = 0x00000101
	SGD_SM1_CBC   = 0x00000102
	SGD_SM1_CFB   = 0x00000104
	SGD_SM1_OFB   = 0x00000108
	SGD_SM1_MAC   = 0x00000110
	SGD_SM1_CTR   = 0x00000120
	SGD_SSF33_ECB = 0x00000201
	SGD_SSF33_CBC = 0x00000202
	SGD_SSF33_CFB = 0x00000204
	SGD_SSF33_OFB = 0x00000208
	SGD_SSF33_MAC = 0x00000210
	SGD_SSF33_CTR = 0x00000220
	SGD_SMS4_ECB  = 0x00000401
	SGD_SMS4_CBC  = 0x00000402
	SGD_SMS4_CFB  = 0x00000404
	SGD_SMS4_OFB  = 0x00000408
	SGD_SMS4_MAC  = 0x00000410
	SGD_SMS4_CTR  = 0x00000420
	SGD_3DES_ECB  = 0x00000801
	SGD_3DES_CBC  = 0x00000802
	SGD_3DES_CFB  = 0x00000804
	SGD_3DES_OFB  = 0x00000808
	SGD_3DES_MAC  = 0x00000810
	SGD_3DES_CTR  = 0x00000820
	SGD_AES_ECB   = 0x00002001
	SGD_AES_CBC   = 0x00002002
	SGD_AES_CFB   = 0x00002004
	SGD_AES_OFB   = 0x00002008
	SGD_AES_MAC   = 0x00002010
	SGD_AES_CTR   = 0x00002020
	SGD_RSA       = 0x00010000
	SGD_RSA_SIGN  = 0x00010100
	SGD_RSA_ENC   = 0x00010200
	SGD_SM2       = 0x00020100
	SGD_SM2_1     = 0x00020200
	SGD_SM2_2     = 0x00020400
	SGD_SM2_3     = 0x00020800
	SGD_SM9       = 0x00100000
	SGD_SM9_1     = 0x00100100
	SGD_SM9_2     = 0x00100200
	SGD_SM9_3     = 0x00100400
	SGD_SM9_4     = 0x00100800
	SGD_SM3       = 0x00000001
	SGD_SHA1      = 0x00000002
	SGD_SHA256    = 0x00000004
	SGD_SHA512    = 0x00000008
	SGD_SHA384    = 0x00000010
	SGD_SHA224    = 0x00000020
	SGD_MD5       = 0x00000080
)

Variables

View Source
var StrErrors = map[uint]string{
	0x01000001: "SDR_UNKNOWERR",
	0x01000002: "SDR_NOTSUPPORT",
	0x01000003: "SDR_COMMFAIL",
	0x01000004: "SDR_HARDFAIL",
	0x01000005: "SDR_OPENDEVICE",
	0x01000006: "SDR_OPENSESSION",
	0x01000007: "SDR_PARDENY",
	0x01000008: "SDR_KEYNOTEXIST",
	0x01000009: "SDR_ALGNOTSUPPORT",
	0x0100000A: "SDR_ALGMODNOTSUPPORT",
	0x0100000B: "SDR_PKOPERR",
	0x0100000C: "SDR_SKOPERR",
	0x0100000D: "SDR_SIGNERR",
	0x0100000E: "SDR_VERIFYERR",
	0x0100000F: "SDR_SYMOPERR",
	0x01000010: "SDR_STEPERR",
	0x01000011: "SDR_FILESIZEERR",
	0x01000012: "SDR_FILENOEXIST",
	0x01000013: "SDR_FILEOFSERR",
	0x01000014: "SDR_KEYTYPEERR",
	0x01000015: "SDR_KEYERR",

	0x01010001: "SWR_INVALID_USER",
	0x01010002: "SWR_INVALID_AUTHENCODE",
	0x01010003: "SWR_PROTOCOL_VER_ERR",
	0x01010004: "SWR_INVALID_COMMAND",
	0x01010005: "SWR_INVALID_PACKAGE",

	0x01010006: "SWR_FILE_ALREADY_EXIST",

	0x01010100: "SWR_SOCKET_ERR_BASE",

	0x01010101: "SWR_CONNECT_ERR",
	0x01010102: "SWR_SET_SOCKOPT_ERR",
	0x01010104: "SWR_SOCKET_SEND_ERR",
	0x01010105: "SWR_SOCKET_RECV_ERR",
	0x01010206: "SWR_SOCKET_RECV_0",

	0x01010201: "SWR_NO_AVAILABLE_HSM",
	0x01010202: "SWR_NO_AVAILABLE_CSM",
	0x01010301: "SWR_CONFIG_ERR",

	0x01020101: "SDR_BUFFER_TOO_SMALL",
	0x01020102: "SDR_DATA_PAD",
	0x01020103: "SDR_DATA_SIZE",
	0x01020104: "SDR_CRYPTO_NOT_INIT",

	0x01021001: "SWR_MANAGEMENT_DENY",
	0x01021002: "SWR_OPERATION_DENY",
	0x01021003: "SWR_DEVICE_STATUS_ERR",
	0x01021011: "SWR_LOGIN_ERR",
	0x01021012: "SWR_USERID_ERR",
	0x01021013: "SWR_PARAMENT_ERR",
	0x01020020: "SWR_KEYTYPEERR",
}

Functions

func CMessage

func CMessage(data []byte) (dataPtr C.SGD_UCHAR_PRT)

func ConvertToECCCipherC

func ConvertToECCCipherC(encData ECCCipher) (pucEncData C.ECCCipher)

func ConvertToECCSignatureC

func ConvertToECCSignatureC(signature ECCSignature) (pSignature C.ECCSignature)

func ConvertToECCrefPrivateKeyC

func ConvertToECCrefPrivateKeyC(privateKey ECCrefPrivateKey) (pucPrivateKey C.ECCrefPrivateKey)

func ConvertToECCrefPublicKeyC

func ConvertToECCrefPublicKeyC(publicKey ECCrefPublicKey) (pucPublicKey C.ECCrefPublicKey)

func ConvertToRSArefPrivateKeyC

func ConvertToRSArefPrivateKeyC(privateKey RSArefPrivateKey) (pucPrivateKey C.RSArefPrivateKey)

func ConvertToRSArefPublicKeyC

func ConvertToRSArefPublicKeyC(publicKey RSArefPublicKey) (pucPublicKey C.RSArefPublicKey)

func ToError

func ToError(e C.SGD_RV) error

Types

type AgreementHandleType

type AgreementHandleType C.SGD_HANDLE

type Ctx

type Ctx struct {
	// contains filtered or unexported fields
}

func New

func New(libPath string) *Ctx

func (*Ctx) Destroy

func (c *Ctx) Destroy()

func (*Ctx) SDFCalculateMAC

func (c *Ctx) SDFCalculateMAC(sessionHandle SessionHandleType, hKeyHandle KeyHandleType, uiAlgID uint, iv []byte, data []byte, dataLength uint) (mac []byte, macLength uint, err error)

SDFCalculateMAC 42.计算 MAC

func (*Ctx) SDFCloseDevice

func (c *Ctx) SDFCloseDevice(deviceHandle DeviceHandleType) (err error)

SDFCloseDevice 2.关闭设备

func (*Ctx) SDFCloseSession

func (c *Ctx) SDFCloseSession(sessionHandle SessionHandleType) (err error)

SDFCloseSession 4.关闭会话

func (*Ctx) SDFCreateFile

func (c *Ctx) SDFCreateFile(sessionHandle SessionHandleType, fileName []byte, uiFileSize uint) (err error)

SDFCreateFile 46.创建文件

func (*Ctx) SDFDecrypt

func (c *Ctx) SDFDecrypt(sessionHandle SessionHandleType, hKeyHandle KeyHandleType, uiAlgID uint, iv []byte, encData []byte, encDataLength uint) (data []byte, dataLength uint, err error)

SDFDecrypt 41.对称解密

func (*Ctx) SDFDeleteFile

func (c *Ctx) SDFDeleteFile(sessionHandle SessionHandleType, fileName []byte) (err error)

SDFDeleteFile 49.删除文件

func (*Ctx) SDFDestroyKey

func (c *Ctx) SDFDestroyKey(sessionHandle SessionHandleType, hKeyHandle KeyHandleType) (err error)

SDFDestroyKey 29.销毁会话密钥

func (*Ctx) SDFEncrypt

func (c *Ctx) SDFEncrypt(sessionHandle SessionHandleType, keyHandle KeyHandleType, algID uint, iv []byte, data []byte, dataLength uint) (encData []byte, encDataLength uint, err error)

SDFEncrypt 40.对称加密

func (*Ctx) SDFExchangeDigitEnvelopeBaseOnECC

func (c *Ctx) SDFExchangeDigitEnvelopeBaseOnECC(sessionHandle SessionHandleType, uiKeyIndex uint, uiAlgID uint, publicKey ECCrefPublicKey, encDataIn ECCCipher) (encDataOut ECCCipher, err error)

SDFExchangeDigitEnvelopeBaseOnECC 25.基于 ECC算法的数字信封转换

func (*Ctx) SDFExchangeDigitEnvelopeBaseOnRSA

func (c *Ctx) SDFExchangeDigitEnvelopeBaseOnRSA(sessionHandle SessionHandleType, keyIndex uint, publicKey RSArefPublicKey, deInput []byte, deLength uint) (deOutput []byte, deOutputLength uint, err error)

SDFExchangeDigitEnvelopeBaseOnRSA 15.基于 RSA 算法的数字信封转换

func (*Ctx) SDFExportEncPublicKey_ECC

func (c *Ctx) SDFExportEncPublicKey_ECC(sessionHandle SessionHandleType, uiKeyIndex uint) (publicKey ECCrefPublicKey, err error)

SDFExportEncPublicKey_ECC 17.导出 ECC加密公钥

func (*Ctx) SDFExportEncPublicKey_RSA

func (c *Ctx) SDFExportEncPublicKey_RSA(sessionHandle SessionHandleType, keyIndex uint) (publicKey RSArefPublicKey, err error)

SDFExportEncPublicKey_RSA 10.导出 RSA 加密公钥

func (*Ctx) SDFExportKeyWithEPK_ECC

func (c *Ctx) SDFExportKeyWithEPK_ECC(sessionHandle SessionHandleType, hKeyHandle KeyHandleType, uiAlgID uint, publicKey ECCrefPublicKey) (key ECCCipher, err error)

SDFExportKeyWithEPK_ECC 54. EPK方式导出ECC密钥

func (*Ctx) SDFExportKeyWithEPK_RSA

func (c *Ctx) SDFExportKeyWithEPK_RSA(sessionHandle SessionHandleType, hKeyHandle KeyHandleType, publicKey RSArefPublicKey) (key []byte, err error)

SDFExportKeyWithEPK_RSA 53. EPK方式导出RSA密钥

func (*Ctx) SDFExportKeyWithKEK

func (c *Ctx) SDFExportKeyWithKEK(sessionHandle SessionHandleType, hKeyHandle KeyHandleType, uiAlgID uint, uiKEKIndex uint) (key []byte, err error)

SDFExportKeyWithKEK 55. EPK方式导出密钥

func (*Ctx) SDFExportSignPublicKey_ECC

func (c *Ctx) SDFExportSignPublicKey_ECC(sessionHandle SessionHandleType, uiKeyIndex uint) (publicKey ECCrefPublicKey, err error)

SDFExportSignPublicKey_ECC 16.导出 ECC签名公钥

func (*Ctx) SDFExportSignPublicKey_RSA

func (c *Ctx) SDFExportSignPublicKey_RSA(sessionHandle SessionHandleType, keyIndex uint) (publicKey RSArefPublicKey, err error)

SDFExportSignPublicKey_RSA 9.导出 RSA 签名公钥

func (*Ctx) SDFExternalDecrypt_ECC

func (c *Ctx) SDFExternalDecrypt_ECC(sessionHandle SessionHandleType, uiAlgID uint, privateKey ECCrefPrivateKey, encData ECCCipher) (data []byte, dataLength uint, err error)

SDFExternalDecrypt_ECC 39.外部密钥 ECC解密

func (*Ctx) SDFExternalEncrypt_ECC

func (c *Ctx) SDFExternalEncrypt_ECC(sessionHandle SessionHandleType, uiAlgID uint, publicKey ECCrefPublicKey, data []byte, dataLength uint) (encData ECCCipher, err error)

SDFExternalEncrypt_ECC 38.外部密钥 ECC加密

func (*Ctx) SDFExternalPrivateKeyOperation_RSA

func (c *Ctx) SDFExternalPrivateKeyOperation_RSA(sessionHandle SessionHandleType, privateKey RSArefPrivateKey, dataInput []byte, uiInputLength uint) (dataOutput []byte, err error)

SDFExternalPrivateKeyOperation_RSA 31. 外部私钥RSA运算

func (*Ctx) SDFExternalPublicKeyOperation_RSA

func (c *Ctx) SDFExternalPublicKeyOperation_RSA(sessionHandle SessionHandleType, publicKey RSArefPublicKey, dataInput []byte, uiInputLength uint) (dataOutput []byte, err error)

SDFExternalPublicKeyOperation_RSA 30.外部公钥 RSA 运算

func (*Ctx) SDFExternalSign_ECC

func (c *Ctx) SDFExternalSign_ECC(sessionHandle SessionHandleType, uiAlgID uint, privateKey ECCrefPrivateKey, pucData []byte, uiDataLength uint) (signature ECCSignature, err error)

SDFExternalSign_ECC 34. 外部密钥ECC签名

func (*Ctx) SDFExternalVerify_ECC

func (c *Ctx) SDFExternalVerify_ECC(sessionHandle SessionHandleType, uiAlgID uint, publicKey ECCrefPublicKey, inputData []byte, uiInputLength uint, signature ECCSignature) (err error)

SDFExternalVerify_ECC 35.外部密钥 ECC验证

func (*Ctx) SDFGenerateAgreementDataAndKeyWithECC

func (c *Ctx) SDFGenerateAgreementDataAndKeyWithECC(sessionHandle SessionHandleType, uiISKIndex uint, uiKeyBits uint, responseID []byte, responseIDLength uint, sponsorID []byte, sponsorIDLength uint, sponsorPublicKey ECCrefPublicKey, sponsorTmpPublicKey ECCrefPublicKey) (responsePublicKey ECCrefPublicKey, responseTmpPublicKey ECCrefPublicKey, keyHandle KeyHandleType, err error)

SDFGenerateAgreementDataAndKeyWithECC 24.产生协商数据并计算会话密钥

func (*Ctx) SDFGenerateAgreementDataWithECC

func (c *Ctx) SDFGenerateAgreementDataWithECC(sessionHandle SessionHandleType, uiISKIndex uint, uiKeyBits uint, sponsorID []byte, sponsorIDLength uint) (sponsorPublicKey ECCrefPublicKey, sponsorTmpPublicKey ECCrefPublicKey, agreementHandle AgreementHandleType, err error)

SDFGenerateAgreementDataWithECC 22.生成密钥协商参数并输出

func (*Ctx) SDFGenerateKeyPair_ECC

func (c *Ctx) SDFGenerateKeyPair_ECC(sessionHandle SessionHandleType, uiAlgID uint, uiKeyBits uint) (publicKey ECCrefPublicKey, privateKey ECCrefPrivateKey, err error)

SDFGenerateKeyPair_ECC 18.产生 ECC非对称密钥对并输出

func (*Ctx) SDFGenerateKeyPair_RSA

func (c *Ctx) SDFGenerateKeyPair_RSA(sessionHandle SessionHandleType, uiKeyBits uint) (publicKey RSArefPublicKey, privateKey RSArefPrivateKey, err error)

SDFGenerateKeyPair_RSA 11.产生 RSA 非对称密钥对并输出

func (*Ctx) SDFGenerateKeyWithECC

func (c *Ctx) SDFGenerateKeyWithECC(sessionHandle SessionHandleType, responseID []byte, responseIDLength uint, responsePublicKey ECCrefPublicKey, responseTmpPublicKey ECCrefPublicKey, hAgreementHandle AgreementHandleType) (keyHandle KeyHandleType, err error)

SDFGenerateKeyWithECC 23.计算会话密钥

func (*Ctx) SDFGenerateKeyWithEPK_ECC

func (c *Ctx) SDFGenerateKeyWithEPK_ECC(sessionHandle SessionHandleType, uiKeyBits uint, uiAlgID uint, publicKey ECCrefPublicKey) (key ECCCipher, keyHandle KeyHandleType, err error)

SDFGenerateKeyWithEPK_ECC 20.生成会话密钥并用外部 ECC公钥加密输出

func (*Ctx) SDFGenerateKeyWithEPK_RSA

func (c *Ctx) SDFGenerateKeyWithEPK_RSA(sessionHandle SessionHandleType, uiKeyBits uint, publicKey RSArefPublicKey) (key []byte, keyLength uint, keyHandle KeyHandleType, err error)

SDFGenerateKeyWithEPK_RSA 13.生成会话密钥并用外部 RSA 公钥加密输出

func (*Ctx) SDFGenerateKeyWithIPK_ECC

func (c *Ctx) SDFGenerateKeyWithIPK_ECC(sessionHandle SessionHandleType, uiIPKIndex uint, uiKeyBits uint) (key ECCCipher, keyHandle KeyHandleType, err error)

SDFGenerateKeyWithIPK_ECC 19.生成会话密钥并用内部 ECC公钥加密输出

func (*Ctx) SDFGenerateKeyWithIPK_RSA

func (c *Ctx) SDFGenerateKeyWithIPK_RSA(sessionHandle SessionHandleType, uiIPKIndex uint, uiKeyBits uint) (key []byte, keyLength uint, keyHandle KeyHandleType, err error)

SDFGenerateKeyWithIPK_RSA 12.生成会话密钥并用内部 RSA 公钥加密输出

func (*Ctx) SDFGenerateKeyWithKEK

func (c *Ctx) SDFGenerateKeyWithKEK(sessionHandle SessionHandleType, uiKeyBits uint, uiAlgID uint, uiKEKIndex uint) ([]byte, uint, KeyHandleType, error)

SDFGenerateKeyWithKEK 26.生成会话密钥并用密钥加密密钥加密输出

func (*Ctx) SDFGenerateRandom

func (c *Ctx) SDFGenerateRandom(sessionHandle SessionHandleType, length uint) (randomData []byte, err error)

SDFGenerateRandom 6.产生随机数

func (*Ctx) SDFGetDeviceInfo

func (c *Ctx) SDFGetDeviceInfo(sessionHandle SessionHandleType) (deviceInfo DeviceInfo, err error)

SDFGetDeviceInfo 5.获取设备信息

func (*Ctx) SDFGetPrivateKeyAccessRight

func (c *Ctx) SDFGetPrivateKeyAccessRight(sessionHandle SessionHandleType, keyIndex uint, password []byte, pwdLength uint) (err error)

SDFGetPrivateKeyAccessRight 7.获取私钥使用权限

func (*Ctx) SDFGetSymmKeyHandle

func (c *Ctx) SDFGetSymmKeyHandle(sessionHandle SessionHandleType, uiKeyIndex uint) (keyHandle KeyHandleType, err error)

SDFGetSymmKeyHandle 50.

func (*Ctx) SDFHashFinal

func (c *Ctx) SDFHashFinal(sessionHandle SessionHandleType) (hash []byte, hashLength uint, err error)

SDFHashFinal 45.杂凑运算结束

func (*Ctx) SDFHashInit

func (c *Ctx) SDFHashInit(sessionHandle SessionHandleType, uiAlgID uint, pucID []byte, uiIDLength uint) (publicKey ECCrefPublicKey, err error)

SDFHashInit 43.杂凑运算初始化

func (*Ctx) SDFHashUpdate

func (c *Ctx) SDFHashUpdate(sessionHandle SessionHandleType, pucData []byte, uiDataLength uint) (err error)

SDFHashUpdate 44.多包杂凑运算

func (*Ctx) SDFImportKey

func (c *Ctx) SDFImportKey(sessionHandle SessionHandleType, pucKey []byte, uiKeyLength uint) (keyHandle KeyHandleType, err error)

SDFImportKey 28.导入明文会话密钥

func (*Ctx) SDFImportKeyWithISK_ECC

func (c *Ctx) SDFImportKeyWithISK_ECC(sessionHandle SessionHandleType, uiISKIndex uint, key ECCCipher) (keyHandle KeyHandleType, err error)

SDFImportKeyWithISK_ECC 21.导入会话密钥并用内部 ECC私钥解密

func (*Ctx) SDFImportKeyWithISK_RSA

func (c *Ctx) SDFImportKeyWithISK_RSA(sessionHandle SessionHandleType, uiKeyBits uint, key []byte, uiKeyLength uint) (keyHandle KeyHandleType, err error)

SDFImportKeyWithISK_RSA 14.导入会话密钥并用内部 RSA 私钥解密

func (*Ctx) SDFImportKeyWithKEK

func (c *Ctx) SDFImportKeyWithKEK(sessionHandle SessionHandleType, uiAlgID uint, uiKEKIndex uint, key []byte, uiKeyLength uint) (keyHandle KeyHandleType, err error)

SDFImportKeyWithKEK 27.导入会话密钥并用密钥加密密钥解密

func (*Ctx) SDFInternalDecrypt_ECC

func (c *Ctx) SDFInternalDecrypt_ECC(sessionHandle SessionHandleType, uiISKIndex uint, uiAlgID uint, encData ECCCipher) (data []byte, dataLength uint, err error)

SDFInternalDecrypt_ECC 52. ECC方式的解密

func (*Ctx) SDFInternalEncrypt_ECC

func (c *Ctx) SDFInternalEncrypt_ECC(sessionHandle SessionHandleType, uiISKIndex uint, uiAlgID uint, pucData []byte, uiDataLength uint) (encData ECCCipher, err error)

SDFInternalEncrypt_ECC 51. ECC方式的加密

func (*Ctx) SDFInternalPrivateKeyOperation_RSA

func (c *Ctx) SDFInternalPrivateKeyOperation_RSA(sessionHandle SessionHandleType, uiKeyIndex uint, inData []byte, uiInputLength uint) (dataOutput []byte, err error)

SDFInternalPrivateKeyOperation_RSA 33.外部私钥 RSA 运算

func (*Ctx) SDFInternalPublicKeyOperation_RSA

func (c *Ctx) SDFInternalPublicKeyOperation_RSA(sessionHandle SessionHandleType, uiKeyIndex uint, pucDataInput []byte, uiInputLength uint) (dataOutput []byte, err error)

SDFInternalPublicKeyOperation_RSA 32.内部公钥 RSA 运算

func (*Ctx) SDFInternalSign_ECC

func (c *Ctx) SDFInternalSign_ECC(sessionHandle SessionHandleType, uiISKIndex uint, pucData []byte, uiDataLength uint) (signature ECCSignature, err error)

SDFInternalSign_ECC 36.内部密钥 ECC签名

func (*Ctx) SDFInternalVerify_ECC

func (c *Ctx) SDFInternalVerify_ECC(sessionHandle SessionHandleType, uiISKIndex uint, pucData []byte, uiDataLength uint, signature ECCSignature) (err error)

SDFInternalVerify_ECC 37.内部密钥 ECC验证

func (*Ctx) SDFOpenDevice

func (c *Ctx) SDFOpenDevice() (deviceHandle DeviceHandleType, err error)

SDFOpenDevice 1.打开设备

func (*Ctx) SDFOpenSession

func (c *Ctx) SDFOpenSession(deviceHandle DeviceHandleType) (sessionHandle SessionHandleType, err error)

SDFOpenSession 3.创建会话

func (*Ctx) SDFReadFile

func (c *Ctx) SDFReadFile(sessionHandle SessionHandleType, fileName []byte, uiOffset uint, readLength uint) (buffer []byte, readLength1 uint, err error)

SDFReadFile 47.读取文件

func (*Ctx) SDFReleasePrivateKeyAccessRight

func (c *Ctx) SDFReleasePrivateKeyAccessRight(sessionHandle SessionHandleType, keyIndex uint) (err error)

SDFReleasePrivateKeyAccessRight 8.释放私钥使用权限

func (*Ctx) SDFWriteFile

func (c *Ctx) SDFWriteFile(sessionHandle SessionHandleType, fileName []byte, uiOffset uint, buffer []byte, bufferLength uint) (err error)

SDFWriteFile 48.写文件

type DeviceHandleType

type DeviceHandleType C.SGD_HANDLE

type DeviceInfo

type DeviceInfo struct {
	IssuerName      string
	DeviceName      string
	DeviceSerial    string
	DeviceVersion   uint
	StandardVersion uint
	AsymAlgAbility  [2]uint
	SymAlgAbility   uint
	HashAlgAbility  uint
	BufferSize      uint
}

func ConvertToDeviceInfoGo

func ConvertToDeviceInfoGo(deviceInfo1 C.DEVICEINFO) (deviceInfo DeviceInfo)

type DeviceRunStatus

type DeviceRunStatus struct {
	Onboot      uint
	Service     uint
	Concurrency uint
	Memtotal    uint
	Memfree     uint
	Cpu         uint
	Reserve1    uint
	Reserve2    uint
}

type ECCCipher

type ECCCipher struct {
	X string
	Y string
	M string
	L uint
	C string
}

func ConvertToECCCipherGo

func ConvertToECCCipherGo(pucKey C.ECCCipher) (key ECCCipher)

type ECCSignature

type ECCSignature struct {
	R string
	S string
}

func ConvertToECCSignatureGo

func ConvertToECCSignatureGo(pucSignature C.ECCSignature) (signature ECCSignature)

type ECCrefPrivateKey

type ECCrefPrivateKey struct {
	Bits uint
	K    string
}

func ConvertToECCrefPrivateKeyGo

func ConvertToECCrefPrivateKeyGo(pucPrivateKey C.ECCrefPrivateKey) (privateKey ECCrefPrivateKey)

type ECCrefPublicKey

type ECCrefPublicKey struct {
	Bits uint
	X    string
	Y    string
}

func ConvertToECCrefPublicKeyGo

func ConvertToECCrefPublicKeyGo(pucPublicKey C.ECCrefPublicKey) (publicKey ECCrefPublicKey)

type KeyHandleType

type KeyHandleType C.SGD_HANDLE

type RSArefPrivateKey

type RSArefPrivateKey struct {
	Bits  uint
	M     string
	E     string
	D     string
	Prime [2]string
	Pexp  [2]string
	Coef  string
}

func ConvertToRSArefPrivateKeyGo

func ConvertToRSArefPrivateKeyGo(pucPrivateKey C.RSArefPrivateKey) (privateKey RSArefPrivateKey)

type RSArefPrivateKeyLite

type RSArefPrivateKeyLite struct {
	Bits  uint
	M     string
	E     string
	D     string
	Prime [2]string
	Pexp  [2]string
	Coef  string
}

type RSArefPublicKey

type RSArefPublicKey struct {
	Bits uint
	M    string
	E    string
}

func ConvertToRSArefPublicKeyGo

func ConvertToRSArefPublicKeyGo(pucPublicKey C.RSArefPublicKey) (publicKey RSArefPublicKey)

type RSArefPublicKeyLite

type RSArefPublicKeyLite struct {
	Bits uint
	M    string
	E    string
}

type SM9Cipher

type SM9Cipher struct {
	X string
	Y string
	H string
	L uint
	C string
}

type SM9Signature

type SM9Signature struct {
	H string
	X string
	Y string
}

type SM9refEncMasterPrivateKey

type SM9refEncMasterPrivateKey struct {
	Bits uint
	S    string
}

type SM9refEncMasterPublicKey

type SM9refEncMasterPublicKey struct {
	Bits uint
	X    string
	Y    string
}

type SM9refEncUserPrivateKey

type SM9refEncUserPrivateKey struct {
	Bits uint
	Xa   string
	Xb   string
	Ya   string
	Yb   string
}

type SM9refKeyPackage

type SM9refKeyPackage struct {
	X string
	Y string
}

type SM9refSignMasterPrivateKey

type SM9refSignMasterPrivateKey struct {
	Bits uint
	S    string
}

type SM9refSignMasterPublicKey

type SM9refSignMasterPublicKey struct {
	Bits uint
	Xa   string
	Xb   string
	Ya   string
	Yb   string
}

type SM9refSignUserPrivateKey

type SM9refSignUserPrivateKey struct {
	Bits uint
	X    string
	Y    string
}

type SessionHandleType

type SessionHandleType C.SGD_HANDLE

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL