Documentation
¶
Overview ¶
Package sdf provides Go bindings for the GM/T 0018-2012 Security Device Framework (SDF) API.
The package loads a vendor SDF shared library at runtime. It does not link against a particular device SDK at build time. A Context owns one loaded library; device, session, key, and agreement handles remain owned by the vendor implementation. Device, session, and key handles use their matching close/destroy calls; agreement-handle consumption follows SDF key agreement.
SDF handles are not assumed to be safe for concurrent use. In particular, callers must serialize operations that use the same session, key, or agreement handle unless the device vendor explicitly documents otherwise.
Index ¶
- Constants
- Variables
- type ALGID
- type AgreementHandle
- type Algorithm
- type Context
- func (c *Context) CalculateMAC(session SessionHandle, key KeyHandle, algorithm Algorithm, iv, data []byte, ...) ([]byte, error)
- func (c *Context) Close() error
- func (c *Context) CloseDevice(device DeviceHandle) error
- func (c *Context) CloseSession(session SessionHandle) error
- func (c *Context) CreateFile(session SessionHandle, name []byte, size uint32) error
- func (c *Context) Decrypt(session SessionHandle, key KeyHandle, algorithm Algorithm, ...) ([]byte, error)
- func (c *Context) DeleteFile(session SessionHandle, name []byte) error
- func (c *Context) Destroy()
- func (c *Context) DestroyKey(session SessionHandle, key KeyHandle) error
- func (c *Context) Encrypt(session SessionHandle, key KeyHandle, algorithm Algorithm, ...) ([]byte, error)
- func (c *Context) ExchangeDigitEnvelopeECC(session SessionHandle, keyIndex uint32, algorithm Algorithm, ...) (ECCCipher, error)
- func (c *Context) ExchangeDigitEnvelopeRSA(session SessionHandle, keyIndex uint32, publicKey RSAPublicKey, input []byte, ...) ([]byte, error)
- func (c *Context) ExportEncPublicKeyECC(session SessionHandle, keyIndex uint32) (ECCPublicKey, error)
- func (c *Context) ExportEncPublicKeyRSA(session SessionHandle, keyIndex uint32) (RSAPublicKey, error)
- func (c *Context) ExportSignPublicKeyECC(session SessionHandle, keyIndex uint32) (ECCPublicKey, error)
- func (c *Context) ExportSignPublicKeyRSA(session SessionHandle, keyIndex uint32) (RSAPublicKey, error)
- func (c *Context) ExternalEncryptECC(session SessionHandle, algorithm Algorithm, publicKey ECCPublicKey, ...) (ECCCipher, error)
- func (c *Context) ExternalPublicKeyOperationRSA(session SessionHandle, publicKey RSAPublicKey, input []byte, ...) ([]byte, error)
- func (c *Context) ExternalVerifyECC(session SessionHandle, algorithm Algorithm, publicKey ECCPublicKey, ...) error
- func (c *Context) GenerateAgreementDataAndKeyECC(session SessionHandle, keyIndex, bits uint32, responseID, sponsorID []byte, ...) (ECCPublicKey, ECCPublicKey, KeyHandle, error)
- func (c *Context) GenerateAgreementDataECC(session SessionHandle, keyIndex, bits uint32, sponsorID []byte) (ECCPublicKey, ECCPublicKey, AgreementHandle, error)
- func (c *Context) GenerateKeyECC(session SessionHandle, responseID []byte, ...) (KeyHandle, error)
- func (c *Context) GenerateKeyPairECC(session SessionHandle, algorithm Algorithm, bits uint32) (ECCPublicKey, ECCPrivateKey, error)
- func (c *Context) GenerateKeyPairRSA(session SessionHandle, bits uint32) (RSAPublicKey, RSAPrivateKey, error)
- func (c *Context) GenerateKeyWithEPKECC(session SessionHandle, bits uint32, algorithm Algorithm, ...) (ECCCipher, KeyHandle, error)
- func (c *Context) GenerateKeyWithEPKRSA(session SessionHandle, bits uint32, publicKey RSAPublicKey, outputCapacity int) ([]byte, KeyHandle, error)
- func (c *Context) GenerateKeyWithIPKECC(session SessionHandle, keyIndex, bits uint32) (ECCCipher, KeyHandle, error)
- func (c *Context) GenerateKeyWithIPKRSA(session SessionHandle, keyIndex, bits uint32, outputCapacity int) ([]byte, KeyHandle, error)
- func (c *Context) GenerateKeyWithKEK(session SessionHandle, bits uint32, algorithm Algorithm, keyIndex uint32, ...) ([]byte, KeyHandle, error)
- func (c *Context) GenerateRandom(session SessionHandle, length int) ([]byte, error)
- func (c *Context) GetDeviceInfo(session SessionHandle) (DeviceInfo, error)
- func (c *Context) GetPrivateKeyAccessRight(session SessionHandle, keyIndex uint32, password []byte) error
- func (c *Context) HasFunction(name string) bool
- func (c *Context) HashFinal(session SessionHandle, outputCapacity int) ([]byte, error)
- func (c *Context) HashInit(session SessionHandle, algorithm Algorithm, publicKey *ECCPublicKey, id []byte) error
- func (c *Context) HashUpdate(session SessionHandle, data []byte) error
- func (c *Context) ImportKeyWithISKECC(session SessionHandle, keyIndex uint32, encrypted ECCCipher) (KeyHandle, error)
- func (c *Context) ImportKeyWithISKRSA(session SessionHandle, keyIndex uint32, encryptedKey []byte) (KeyHandle, error)
- func (c *Context) ImportKeyWithKEK(session SessionHandle, algorithm Algorithm, keyIndex uint32, ...) (KeyHandle, error)
- func (c *Context) InternalDecryptECC(session SessionHandle, keyIndex uint32, algorithm Algorithm, ...) ([]byte, error)
- func (c *Context) InternalEncryptECC(session SessionHandle, keyIndex uint32, algorithm Algorithm, data []byte) (ECCCipher, error)
- func (c *Context) InternalPrivateKeyOperationRSA(session SessionHandle, keyIndex uint32, input []byte, outputCapacity int) ([]byte, error)
- func (c *Context) InternalPublicKeyOperationRSA(session SessionHandle, keyIndex uint32, input []byte, outputCapacity int) ([]byte, error)
- func (c *Context) InternalSignECC(session SessionHandle, keyIndex uint32, data []byte) (ECCSignature, error)
- func (c *Context) InternalVerifyECC(session SessionHandle, keyIndex uint32, data []byte, signature ECCSignature) error
- func (c *Context) OpenDevice() (DeviceHandle, error)
- func (c *Context) OpenSession(device DeviceHandle) (SessionHandle, error)
- func (c *Context) ReadFile(session SessionHandle, name []byte, offset uint32, length int) ([]byte, error)
- func (c *Context) ReleasePrivateKeyAccessRight(session SessionHandle, keyIndex uint32) error
- func (c *Context) WriteFile(session SessionHandle, name []byte, offset uint32, data []byte) error
- type DEVICEINFO
- type DeviceHandle
- type DeviceInfo
- type ECCCipher
- type ECCPrivateKey
- type ECCPublicKey
- type ECCSignature
- type ECCrefPrivateKey
- type ECCrefPublicKey
- type Error
- type KeyHandle
- type RSAPrivateKey
- type RSAPublicKey
- type RSArefPrivateKey
- type RSArefPublicKey
- type SessionHandle
Constants ¶
const ( SDR_OK = SDROK SDR_BASE = SDRBase SDR_UNKNOWERR = SDRUnknown SDR_NOTSUPPORT = SDRNotSupported SDR_COMMFAIL = SDRCommunication SDR_HARDFAIL = SDRHardwareFailure SDR_OPENDEVICE = SDROpenDevice SDR_OPENSESSION = SDROpenSession SDR_PARDENY = SDRPermissionDenied SDR_KEYNOTEXIST = SDRKeyNotExist SDR_ALGNOTSUPPORT = SDRAlgorithm SDR_ALGMODNOTSUPPORT = SDRAlgorithmMode SDR_PKOPERR = SDRPublicKey SDR_SKOPERR = SDRPrivateKey SDR_SIGNERR = SDRSign SDR_VERIFYERR = SDRVerify SDR_SYMOPERR = SDRSymmetric SDR_STEPERR = SDRStep SDR_FILESIZEERR = SDRFileSize SDR_FILENOEXIST = SDRFileNotExist SDR_FILEOFSERR = SDRFileOffset SDR_KEYTYPEERR = SDRKeyType SDR_KEYERR = SDRKey SDR_ENCDATAERR = SDREncryptedData SDR_RANDERR = SDRRandom SDR_PRKRERR = SDRPrivateKeyAccess SDR_MACERR = SDRMAC SDR_FILEEXISTS = SDRFileExists SDR_FILEEXSITS = SDRFileExists SDR_FILEWERR = SDRFileWrite SDR_NOBUFFER = SDRNoBuffer SDR_INARGERR = SDRInputArgument SDR_OUTARGERR = SDROutputArgument )
Standard SDF return-code spellings.
const ( RSAMaxBits = 2048 RSAMaxLen = (RSAMaxBits + 7) / 8 RSAMaxPBits = (RSAMaxBits + 1) / 2 RSAMaxPLen = (RSAMaxPBits + 7) / 8 ECCMaxBits = 512 ECCMaxLen = (ECCMaxBits + 7) / 8 ECCMaxCiphertext = 255 SM3DigestSize = 32 )
const ( SGD_ECB = SGDECB SGD_CBC = SGDCBC SGD_CFB = SGDCFB SGD_OFB = SGDOFB SGD_MAC = SGDMAC SGD_EEA3 = SGDEEA3 SGD_EIA3 = SGDEIA3 SGD_SM1 = SGDSM1 SGD_SSF33 = SGDSSF33 SGD_SM4 = SGDSM4 SGD_ZUC = SGDZUC SGD_SM1_ECB = SGDSM1ECB SGD_SM1_CBC = SGDSM1CBC SGD_SM1_CFB = SGDSM1CFB SGD_SM1_OFB = SGDSM1OFB SGD_SM1_MAC = SGDSM1MAC SGD_SSF33_ECB = SGDSSF33ECB SGD_SSF33_CBC = SGDSSF33CBC SGD_SSF33_CFB = SGDSSF33CFB SGD_SSF33_OFB = SGDSSF33OFB SGD_SSF33_MAC = SGDSSF33MAC SGD_SM4_ECB = SGDSM4ECB SGD_SM4_CBC = SGDSM4CBC SGD_SM4_CFB = SGDSM4CFB SGD_SM4_OFB = SGDSM4OFB SGD_SM4_MAC = SGDSM4MAC SGD_ZUC_EEA3 = SGDZUCEEA3 SGD_ZUC_EIA3 = SGDZUCEIA3 SGD_PK_SIGN = SGDPKSign SGD_PK_DH = SGDPKDH SGD_PK_ENC = SGDPKEnc SGD_RSA = SGDRSA SGD_RSA_SIGN = SGDRSASign SGD_RSA_ENC = SGDRSAEnc SGD_SM2 = SGDSM2 SGD_SM2_1 = SGDSM2Sign SGD_SM2_2 = SGDSM2Key SGD_SM2_3 = SGDSM2Enc SGD_SM3 = SGDSM3 SGD_SHA1 = SGDSHA1 SGD_SHA256 = SGDSHA256 SGD_SM3_RSA = SGDSM3RSA SGD_SHA1_RSA = SGDSHA1RSA SGD_SHA256_RSA = SGDSHA256RSA SGD_SM3_SM2 = SGDSM3SM2 )
Standard SDF/SGD spellings are provided alongside the Go-style names so callers can map vendor documentation without translating constants.
const MaxFileNameLength = 128
Variables ¶
Functions ¶
This section is empty.
Types ¶
type AgreementHandle ¶
type AgreementHandle uintptr
AgreementHandle is an opaque handle returned by SDF key agreement setup.
type Algorithm ¶
type Algorithm uint32
Algorithm identifies an algorithm or algorithm mode from GM/T 0006.
const ( SGDECB Algorithm = 0x00000001 SGDCBC Algorithm = 0x00000002 SGDCFB Algorithm = 0x00000004 SGDOFB Algorithm = 0x00000008 SGDMAC Algorithm = 0x00000010 SGDEEA3 Algorithm = 0x00000001 SGDEIA3 Algorithm = 0x00000002 SGDSM1 Algorithm = 0x00000100 SGDSSF33 Algorithm = 0x00000200 SGDSM4 Algorithm = 0x00000400 SGDZUC Algorithm = 0x00000800 SGDSM1ECB Algorithm = SGDSM1 | SGDECB SGDSM1CBC Algorithm = SGDSM1 | SGDCBC SGDSM1CFB Algorithm = SGDSM1 | SGDCFB SGDSM1OFB Algorithm = SGDSM1 | SGDOFB SGDSM1MAC Algorithm = SGDSM1 | SGDMAC SGDSSF33ECB Algorithm = SGDSSF33 | SGDECB SGDSSF33CBC Algorithm = SGDSSF33 | SGDCBC SGDSSF33CFB Algorithm = SGDSSF33 | SGDCFB SGDSSF33OFB Algorithm = SGDSSF33 | SGDOFB SGDSSF33MAC Algorithm = SGDSSF33 | SGDMAC SGDSM4ECB Algorithm = SGDSM4 | SGDECB SGDSM4CBC Algorithm = SGDSM4 | SGDCBC SGDSM4CFB Algorithm = SGDSM4 | SGDCFB SGDSM4OFB Algorithm = SGDSM4 | SGDOFB SGDSM4MAC Algorithm = SGDSM4 | SGDMAC SGDZUCEEA3 Algorithm = SGDZUC | SGDEEA3 SGDZUCEIA3 Algorithm = SGDZUC | SGDEIA3 SGDPKSign Algorithm = 0x00000100 SGDPKDH Algorithm = 0x00000200 SGDPKEnc Algorithm = 0x00000400 SGDRSA Algorithm = 0x00010000 SGDRSASign = SGDRSA | SGDPKSign SGDRSAEnc = SGDRSA | SGDPKEnc SGDSM2 Algorithm = 0x00020100 SGDSM2Sign Algorithm = 0x00020200 SGDSM2Key Algorithm = 0x00020400 SGDSM2Enc Algorithm = 0x00020800 SGDSM3 Algorithm = 0x00000001 SGDSHA1 Algorithm = 0x00000002 SGDSHA256 Algorithm = 0x00000004 SGDSM3RSA = SGDSM3 | SGDRSA SGDSHA1RSA = SGDSHA1 | SGDRSA SGDSHA256RSA = SGDSHA256 | SGDRSA SGDSM3SM2 = SGDSM3 | SGDSM2 )
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context owns one loaded SDF shared library. A Context must not be copied after first use.
func New ¶
New loads an SDF library and returns nil on failure. Open should be preferred when the loader error is useful to the caller.
func Open ¶
Open loads an SDF shared library. Individual SDF entry points are resolved independently; calling an entry point absent from the library returns SDRNotSupported.
func (*Context) CalculateMAC ¶
func (*Context) Close ¶
Close unloads the shared library after all in-flight calls finish. It does not close device/session handles or destroy key/agreement handles.
func (*Context) CloseDevice ¶
func (c *Context) CloseDevice(device DeviceHandle) error
CloseDevice calls SDF_CloseDevice.
func (*Context) CloseSession ¶
func (c *Context) CloseSession(session SessionHandle) error
CloseSession calls SDF_CloseSession.
func (*Context) CreateFile ¶
func (c *Context) CreateFile(session SessionHandle, name []byte, size uint32) error
func (*Context) Decrypt ¶
func (c *Context) Decrypt(session SessionHandle, key KeyHandle, algorithm Algorithm, iv, ciphertext []byte, outputCapacity int) ([]byte, error)
Decrypt calls SDF_Decrypt. Some vendor implementations mutate iv; callers that need to preserve it must pass a copy.
func (*Context) DeleteFile ¶
func (c *Context) DeleteFile(session SessionHandle, name []byte) error
func (*Context) Destroy ¶
func (c *Context) Destroy()
Destroy is an alias for Close, matching the lifecycle vocabulary used by some dynamic cryptographic-library wrappers.
func (*Context) DestroyKey ¶
func (c *Context) DestroyKey(session SessionHandle, key KeyHandle) error
func (*Context) Encrypt ¶
func (c *Context) Encrypt(session SessionHandle, key KeyHandle, algorithm Algorithm, iv, plaintext []byte, outputCapacity int) ([]byte, error)
Encrypt calls SDF_Encrypt. Some vendor implementations mutate iv; callers that need to preserve it must pass a copy.
func (*Context) ExchangeDigitEnvelopeECC ¶
func (c *Context) ExchangeDigitEnvelopeECC(session SessionHandle, keyIndex uint32, algorithm Algorithm, publicKey ECCPublicKey, input ECCCipher) (ECCCipher, error)
func (*Context) ExchangeDigitEnvelopeRSA ¶
func (c *Context) ExchangeDigitEnvelopeRSA(session SessionHandle, keyIndex uint32, publicKey RSAPublicKey, input []byte, outputCapacity int) ([]byte, error)
func (*Context) ExportEncPublicKeyECC ¶
func (c *Context) ExportEncPublicKeyECC(session SessionHandle, keyIndex uint32) (ECCPublicKey, error)
func (*Context) ExportEncPublicKeyRSA ¶
func (c *Context) ExportEncPublicKeyRSA(session SessionHandle, keyIndex uint32) (RSAPublicKey, error)
func (*Context) ExportSignPublicKeyECC ¶
func (c *Context) ExportSignPublicKeyECC(session SessionHandle, keyIndex uint32) (ECCPublicKey, error)
func (*Context) ExportSignPublicKeyRSA ¶
func (c *Context) ExportSignPublicKeyRSA(session SessionHandle, keyIndex uint32) (RSAPublicKey, error)
func (*Context) ExternalEncryptECC ¶
func (c *Context) ExternalEncryptECC(session SessionHandle, algorithm Algorithm, publicKey ECCPublicKey, data []byte) (ECCCipher, error)
func (*Context) ExternalPublicKeyOperationRSA ¶
func (c *Context) ExternalPublicKeyOperationRSA(session SessionHandle, publicKey RSAPublicKey, input []byte, outputCapacity int) ([]byte, error)
func (*Context) ExternalVerifyECC ¶
func (c *Context) ExternalVerifyECC(session SessionHandle, algorithm Algorithm, publicKey ECCPublicKey, data []byte, signature ECCSignature) error
func (*Context) GenerateAgreementDataAndKeyECC ¶
func (c *Context) GenerateAgreementDataAndKeyECC(session SessionHandle, keyIndex, bits uint32, responseID, sponsorID []byte, responsePublicKey, responseTemporaryPublicKey ECCPublicKey) (ECCPublicKey, ECCPublicKey, KeyHandle, error)
func (*Context) GenerateAgreementDataECC ¶
func (c *Context) GenerateAgreementDataECC(session SessionHandle, keyIndex, bits uint32, sponsorID []byte) (ECCPublicKey, ECCPublicKey, AgreementHandle, error)
func (*Context) GenerateKeyECC ¶
func (c *Context) GenerateKeyECC(session SessionHandle, responseID []byte, responsePublicKey, responseTemporaryPublicKey ECCPublicKey, agreement AgreementHandle) (KeyHandle, error)
func (*Context) GenerateKeyPairECC ¶
func (c *Context) GenerateKeyPairECC(session SessionHandle, algorithm Algorithm, bits uint32) (ECCPublicKey, ECCPrivateKey, error)
func (*Context) GenerateKeyPairRSA ¶
func (c *Context) GenerateKeyPairRSA(session SessionHandle, bits uint32) (RSAPublicKey, RSAPrivateKey, error)
func (*Context) GenerateKeyWithEPKECC ¶
func (c *Context) GenerateKeyWithEPKECC(session SessionHandle, bits uint32, algorithm Algorithm, publicKey ECCPublicKey) (ECCCipher, KeyHandle, error)
func (*Context) GenerateKeyWithEPKRSA ¶
func (c *Context) GenerateKeyWithEPKRSA(session SessionHandle, bits uint32, publicKey RSAPublicKey, outputCapacity int) ([]byte, KeyHandle, error)
func (*Context) GenerateKeyWithIPKECC ¶
func (*Context) GenerateKeyWithIPKRSA ¶
func (*Context) GenerateKeyWithKEK ¶
func (*Context) GenerateRandom ¶
func (c *Context) GenerateRandom(session SessionHandle, length int) ([]byte, error)
GenerateRandom calls SDF_GenerateRandom.
func (*Context) GetDeviceInfo ¶
func (c *Context) GetDeviceInfo(session SessionHandle) (DeviceInfo, error)
GetDeviceInfo calls SDF_GetDeviceInfo.
func (*Context) GetPrivateKeyAccessRight ¶
func (c *Context) GetPrivateKeyAccessRight(session SessionHandle, keyIndex uint32, password []byte) error
GetPrivateKeyAccessRight calls SDF_GetPrivateKeyAccessRight.
func (*Context) HasFunction ¶
HasFunction reports whether the loaded module exports an exact symbol name, such as "SDF_OpenDevice".
func (*Context) HashFinal ¶
func (c *Context) HashFinal(session SessionHandle, outputCapacity int) ([]byte, error)
func (*Context) HashInit ¶
func (c *Context) HashInit(session SessionHandle, algorithm Algorithm, publicKey *ECCPublicKey, id []byte) error
func (*Context) HashUpdate ¶
func (c *Context) HashUpdate(session SessionHandle, data []byte) error
func (*Context) ImportKeyWithISKECC ¶
func (*Context) ImportKeyWithISKRSA ¶
func (*Context) ImportKeyWithKEK ¶
func (*Context) InternalDecryptECC ¶
func (*Context) InternalEncryptECC ¶
func (*Context) InternalPrivateKeyOperationRSA ¶
func (*Context) InternalPublicKeyOperationRSA ¶
func (*Context) InternalSignECC ¶
func (c *Context) InternalSignECC(session SessionHandle, keyIndex uint32, data []byte) (ECCSignature, error)
func (*Context) InternalVerifyECC ¶
func (c *Context) InternalVerifyECC(session SessionHandle, keyIndex uint32, data []byte, signature ECCSignature) error
func (*Context) OpenDevice ¶
func (c *Context) OpenDevice() (DeviceHandle, error)
OpenDevice calls SDF_OpenDevice.
func (*Context) OpenSession ¶
func (c *Context) OpenSession(device DeviceHandle) (SessionHandle, error)
OpenSession calls SDF_OpenSession.
func (*Context) ReleasePrivateKeyAccessRight ¶
func (c *Context) ReleasePrivateKeyAccessRight(session SessionHandle, keyIndex uint32) error
ReleasePrivateKeyAccessRight calls SDF_ReleasePrivateKeyAccessRight.
type DEVICEINFO ¶
type DEVICEINFO = DeviceInfo
Conventional aliases mirror the structure names used by SDF headers.
type DeviceHandle ¶
type DeviceHandle uintptr
DeviceHandle is an opaque handle returned by SDF_OpenDevice.
type DeviceInfo ¶
type DeviceInfo struct {
IssuerName [40]byte
DeviceName [16]byte
DeviceSerial [16]byte
DeviceVersion uint32
StandardVersion uint32
AsymAlgAbility [2]uint32
SymAlgAbility uint32
HashAlgAbility uint32
BufferSize uint32
}
DeviceInfo is the GM/T 0018-2012 DEVICEINFO structure.
type ECCCipher ¶
type ECCCipher struct {
X [ECCMaxLen]byte
Y [ECCMaxLen]byte
M [SM3DigestSize]byte
L uint32
C [ECCMaxCiphertext]byte
}
ECCCipher is the GM/T 0018-2012 ECCCipher structure using the SoftSDF 255-byte ciphertext ABI profile. Vendors are known to ship incompatible structure definitions; compare this layout with the target SDK header.
type ECCPrivateKey ¶
ECCPrivateKey is the GM/T 0018-2012 ECCrefPrivateKey structure.
type ECCPublicKey ¶
ECCPublicKey is the GM/T 0018-2012 ECCrefPublicKey structure.
type ECCSignature ¶
ECCSignature is the GM/T 0018-2012 ECCSignature structure.
type ECCrefPrivateKey ¶
type ECCrefPrivateKey = ECCPrivateKey
Conventional aliases mirror the structure names used by SDF headers.
type ECCrefPublicKey ¶
type ECCrefPublicKey = ECCPublicKey
Conventional aliases mirror the structure names used by SDF headers.
type Error ¶
type Error uint32
Error is an SDF return value. The standard values can be inspected with errors.Is because Error implements Is by numeric return code.
const ( SDROK Error = 0x00000000 SDRBase Error = 0x01000000 SDRUnknown Error = SDRBase + 0x00000001 SDRNotSupported Error = SDRBase + 0x00000002 SDRCommunication Error = SDRBase + 0x00000003 SDRHardwareFailure Error = SDRBase + 0x00000004 SDROpenDevice Error = SDRBase + 0x00000005 SDROpenSession Error = SDRBase + 0x00000006 SDRPermissionDenied Error = SDRBase + 0x00000007 SDRKeyNotExist Error = SDRBase + 0x00000008 SDRAlgorithm Error = SDRBase + 0x00000009 SDRAlgorithmMode Error = SDRBase + 0x0000000a SDRPublicKey Error = SDRBase + 0x0000000b SDRPrivateKey Error = SDRBase + 0x0000000c SDRSign Error = SDRBase + 0x0000000d SDRVerify Error = SDRBase + 0x0000000e SDRSymmetric Error = SDRBase + 0x0000000f SDRStep Error = SDRBase + 0x00000010 SDRFileSize Error = SDRBase + 0x00000011 SDRFileNotExist Error = SDRBase + 0x00000012 SDRFileOffset Error = SDRBase + 0x00000013 SDRKeyType Error = SDRBase + 0x00000014 SDRKey Error = SDRBase + 0x00000015 SDREncryptedData Error = SDRBase + 0x00000016 SDRRandom Error = SDRBase + 0x00000017 SDRPrivateKeyAccess Error = SDRBase + 0x00000018 SDRMAC Error = SDRBase + 0x00000019 SDRFileExists Error = SDRBase + 0x0000001a SDRFileWrite Error = SDRBase + 0x0000001b SDRNoBuffer Error = SDRBase + 0x0000001c SDRInputArgument Error = SDRBase + 0x0000001d SDROutputArgument Error = SDRBase + 0x0000001e )
type KeyHandle ¶
type KeyHandle uintptr
KeyHandle is an opaque session-key handle returned by an SDF key operation.
type RSAPrivateKey ¶
type RSAPrivateKey struct {
Bits uint32
M [RSAMaxLen]byte
E [RSAMaxLen]byte
D [RSAMaxLen]byte
Prime [2][RSAMaxPLen]byte
PExp [2][RSAMaxPLen]byte
Coef [RSAMaxPLen]byte
}
RSAPrivateKey is the GM/T 0018-2012 RSArefPrivateKey structure.
type RSAPublicKey ¶
RSAPublicKey is the GM/T 0018-2012 RSArefPublicKey structure.
type RSArefPrivateKey ¶
type RSArefPrivateKey = RSAPrivateKey
Conventional aliases mirror the structure names used by SDF headers.
type RSArefPublicKey ¶
type RSArefPublicKey = RSAPublicKey
Conventional aliases mirror the structure names used by SDF headers.
type SessionHandle ¶
type SessionHandle uintptr
SessionHandle is an opaque handle returned by SDF_OpenSession.