gosdf

package module
v0.0.0-...-d1d04ea Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2021 License: MIT Imports: 3 Imported by: 0

README

libsdf_crypto.so库的go接口

Documentation

Index

Constants

View Source
const (
	ECCref_MAX_BITS              int32 = 512
	ECCref_MAX_LEN               int32 = ((ECCref_MAX_BITS + 7) / 8)
	ECC_MAX_XCOORDINATE_BITS_LEN int32 = 512
	ECC_MAX_YCOORDINATE_BITS_LEN int32 = ECC_MAX_XCOORDINATE_BITS_LEN
	ECC_MAX_MODULUS_BITS_LEN     int32 = ECC_MAX_XCOORDINATE_BITS_LEN
)

Variables

This section is empty.

Functions

func SdfCloseSession

func SdfCloseSession(session int64) int32

SdfCloseSession:关闭会话

func SdfCreateFile

func SdfCreateFile(session int64, fileName string, fileSize uint32) int32

SdfCreateFile:卡中创建文件

func SdfDeleteFile

func SdfDeleteFile(session int64, fileName string) int32

SdfDeleteFile:删除卡中文件

func SdfExit

func SdfExit()

SdfExit:模块退出

func SdfInit

func SdfInit(libPath string) error

SdfInit:模块初始化,打开device、so库,查找符号表

func SdfOpenSession

func SdfOpenSession() int64

SdfOpenSession:打开会话,成功返回session_id >0,失败返回0

func SdfReadFile

func SdfReadFile(session int64, fileName string, offSet, readLen uint32) (int32, []byte)

SdfReadFile:读取卡中文件,从offset开始读取readLen字节

func SdfSm2ExtKeyVerify

func SdfSm2ExtKeyVerify(session int64, pubKey ECCrefPublicKey, buf []byte, len uint32, sig ECCSignature) int32

SdfSm2ExtKeyVerify:sm2外部key验签

func SdfSm3Final

func SdfSm3Final(session int64) (int32, [32]byte)

SdfSm3Update:sm3 final,返回32字节的hash数组

func SdfSm3Init

func SdfSm3Init(session int64) int32

SdfSm3Init:sm3 init,传入打开的会话

func SdfSm3Update

func SdfSm3Update(session int64, buf []byte, len uint32) int32

SdfSm3Update:sm3 update

func SdfWriteFile

func SdfWriteFile(session int64, fileName string, offSet, writeLen uint32, buf []byte) int32

SdfWriteFile:文件写入内容,从offset开始写入readLen字节

Types

type ECCCIPHERBLOB

type ECCCIPHERBLOB struct {
	XCoordinate [ECC_MAX_XCOORDINATE_BITS_LEN / 8]byte
	YCoordinate [ECC_MAX_XCOORDINATE_BITS_LEN / 8]byte
	Hash        [32]byte
	CipherLen   uint32
	Cipher      [128]byte
}

type ECCCipher

type ECCCipher struct {
	M [32]byte
	L uint32
	C [1]byte
	// contains filtered or unexported fields
}

type ECCPUBLICKEYBLOB

type ECCPUBLICKEYBLOB struct {
	BitLen      uint32
	XCoordinate [ECC_MAX_XCOORDINATE_BITS_LEN / 8]byte
	YCoordinate [ECC_MAX_YCOORDINATE_BITS_LEN / 8]byte
}

type ECCSignature

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

func SdfSm2ExtKeySign

func SdfSm2ExtKeySign(session int64, privKey ECCrefPrivateKey, buf []byte, len uint32) (int32, ECCSignature)

SdfSm2ExtKeySign:sm2外部key签名

type ECCrefPrivateKey

type ECCrefPrivateKey struct {
	K [ECCref_MAX_LEN]byte
	// contains filtered or unexported fields
}

type ECCrefPublicKey

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

Jump to

Keyboard shortcuts

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