pcsc

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Rendered for darwin/amd64

Overview

Package pcsc provides purego-based Go bindings for the macOS PCSC framework.

Apple documentation: https://developer.apple.com/documentation/pcsc

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MSCBeginTransaction

func MSCBeginTransaction(pConnection *MSCTokenConnection) uint32

func MSCCancelEventWait

func MSCCancelEventWait() uint32

func MSCChangePIN

func MSCChangePIN(pConnection *MSCTokenConnection, pinNum uint8, pOldPinCode *uint8, oldPinCodeSize uint8, pNewPinCode *uint8, newPinCodeSize uint8) uint32

func MSCClearReset

func MSCClearReset(pConnection *MSCTokenConnection) uint8

func MSCComputeCrypt

func MSCComputeCrypt(pConnection *MSCTokenConnection, cryptInit *MSCCryptInit, pInputData *uint8, inputDataSize uint32, pOutputData *uint8, outputDataSize *uint32) uint32

func MSCCreateObject

func MSCCreateObject(pConnection *MSCTokenConnection, objectID string, objectSize uint32, pObjectACL *MSCObjectACL) uint32

func MSCCreatePIN

func MSCCreatePIN(pConnection *MSCTokenConnection, pinNum uint8, pinAttempts uint8, pPinCode *uint8, pinCodeSize uint32, pUnblockCode *uint8, unblockCodeSize uint8) uint32

func MSCDeleteObject

func MSCDeleteObject(pConnection *MSCTokenConnection, objectID string, zeroFlag uint8) uint32

func MSCEndTransaction

func MSCEndTransaction(pConnection *MSCTokenConnection, endAction uint32) uint32

func MSCEstablishConnection

func MSCEstablishConnection(tokenStruct *MSCTokenInfo, sharingMode uint32, applicationName *uint8, nameSize uint32, pConnection *MSCTokenConnection) uint32

func MSCExportKey

func MSCExportKey(pConnection *MSCTokenConnection, keyNum uint8, pKeyBlob *uint8, keyBlobSize *uint32, pAddParams unsafe.Pointer, addParamsSize uint8) uint32

func MSCExtAuthenticate

func MSCExtAuthenticate(pConnection *MSCTokenConnection, keyNum uint8, cipherMode uint8, cipherDirection uint8, pData *uint8, dataSize uint32) uint32

func MSCExtendedFeature

func MSCExtendedFeature(pConnection *MSCTokenConnection, extFeature uint32, outData *uint8, outLength uint32, inData *uint8, inLength *uint32) uint32

func MSCGenerateKeys

func MSCGenerateKeys(pConnection *MSCTokenConnection, prvKeyNum uint8, pubKeyNum uint8, pParams *MSCGenKeyParams) uint32

func MSCGetCapabilities

func MSCGetCapabilities(pConnection *MSCTokenConnection, tag uint32, value *uint8, length *uint32) uint32

func MSCGetChallenge

func MSCGetChallenge(pConnection *MSCTokenConnection, pSeed *uint8, seedSize uint16, pRandomData *uint8, randomDataSize uint16) uint32

func MSCGetKeyAttributes

func MSCGetKeyAttributes(pConnection *MSCTokenConnection, keyNumber uint8, pKeyInfo *MSCKeyInfo) uint32

func MSCGetObjectAttributes

func MSCGetObjectAttributes(pConnection *MSCTokenConnection, objectID string, pObjectInfo *MSCObjectInfo) uint32

func MSCGetStatus

func MSCGetStatus(pConnection *MSCTokenConnection, pStatusInfo *MSCStatusInfo) uint32

func MSCImportKey

func MSCImportKey(pConnection *MSCTokenConnection, keyNum uint8, pKeyACL *MSCKeyACL, pKeyBlob *uint8, keyBlobSize uint32, keyPolicy *MSCKeyPolicy, pAddParams unsafe.Pointer, addParamsSize uint8) uint32

func MSCIsTokenChanged

func MSCIsTokenChanged(pConnection *MSCTokenConnection) uint8

func MSCIsTokenKnown

func MSCIsTokenKnown(pConnection *MSCTokenConnection) uint8

func MSCIsTokenMoved

func MSCIsTokenMoved(pConnection *MSCTokenConnection) uint8

func MSCIsTokenReset

func MSCIsTokenReset(pConnection *MSCTokenConnection) uint8

func MSCListKeys

func MSCListKeys(pConnection *MSCTokenConnection, seqOption uint8, pKeyInfo *MSCKeyInfo) uint32

func MSCListObjects

func MSCListObjects(pConnection *MSCTokenConnection, seqOption uint8, pObjectInfo *MSCObjectInfo) uint32

func MSCListPINs

func MSCListPINs(pConnection *MSCTokenConnection, pPinBitMask *uint16) uint32

func MSCListTokens

func MSCListTokens(listScope uint32, tokenArray *MSCTokenInfo, arrayLength *uint32) uint32

func MSCLogoutAll

func MSCLogoutAll(pConnection *MSCTokenConnection) uint32

func MSCReadAllocateObject

func MSCReadAllocateObject(pConnection *MSCTokenConnection, objectID string, pOutputData **uint8, dataSize *uint32, rwCallback unsafe.Pointer, addParams unsafe.Pointer) uint32

func MSCReadObject

func MSCReadObject(pConnection *MSCTokenConnection, objectID string, offset uint32, pOutputData *uint8, dataSize uint32, rwCallback unsafe.Pointer, addParams unsafe.Pointer) uint32

func MSCReleaseConnection

func MSCReleaseConnection(pConnection *MSCTokenConnection, endAction uint32) uint32

func MSCUnblockPIN

func MSCUnblockPIN(pConnection *MSCTokenConnection, pinNum uint8, pUnblockCode *uint8, unblockCodeSize uint32) uint32

func MSCVerifyPIN

func MSCVerifyPIN(pConnection *MSCTokenConnection, pinNum uint8, pPinCode *uint8, pinCodeSize uint32) uint32

func MSCWaitForTokenEvent

func MSCWaitForTokenEvent(tokenArray *MSCTokenInfo, arraySize uint32, timeoutValue uint32) uint32

func MSCWriteFramework

func MSCWriteFramework(pConnection *MSCTokenConnection, pInitParams *MSCInitTokenParams) uint32

func MSCWriteObject

func MSCWriteObject(pConnection *MSCTokenConnection, objectID string, offset uint32, pInputData *uint8, dataSize uint32, rwCallback unsafe.Pointer, addParams unsafe.Pointer) uint32

func MscError

func MscError(errorCode uint) string

C function: msc_error

func PcscStringifyError

func PcscStringifyError(err int32) string

C function: pcsc_stringify_error

func SCardBeginTransaction

func SCardBeginTransaction(hCard int32) int32

func SCardCancel

func SCardCancel(hContext int32) int32

func SCardCancelTransaction

func SCardCancelTransaction(hCard int32) int32

func SCardConnect

func SCardConnect(hContext int32, szReader string, dwShareMode uint32, dwPreferredProtocols uint32, phCard *int32, pdwActiveProtocol *uint32) int32

func SCardControl

func SCardControl(hCard int32, pbSendBuffer unsafe.Pointer, cbSendLength uint32, pbRecvBuffer unsafe.Pointer, pcbRecvLength *uint32) int32

func SCardControl132

func SCardControl132(hCard int32, dwControlCode uint32, pbSendBuffer unsafe.Pointer, cbSendLength uint32, pbRecvBuffer unsafe.Pointer, cbRecvLength uint32, lpBytesReturned *uint32) int32

func SCardDisconnect

func SCardDisconnect(hCard int32, dwDisposition uint32) int32

func SCardEndTransaction

func SCardEndTransaction(hCard int32, dwDisposition uint32) int32

func SCardEstablishContext

func SCardEstablishContext(dwScope uint32, pvReserved1 unsafe.Pointer, pvReserved2 unsafe.Pointer, phContext *int32) int32

func SCardGetAttrib

func SCardGetAttrib(hCard int32, dwAttrId uint32, pbAttr *uint8, pcbAttrLen *uint32) int32

func SCardGetStatusChange

func SCardGetStatusChange(hContext int32, dwTimeout uint32, rgReaderStates *SCARD_READERSTATE_A, cReaders uint32) int32

func SCardIsValidContext

func SCardIsValidContext(hContext int32) int32

func SCardListReaderGroups

func SCardListReaderGroups(hContext int32, mszGroups string, pcchGroups *uint32) int32

func SCardListReaders

func SCardListReaders(hContext int32, mszGroups string, mszReaders string, pcchReaders *uint32) int32

func SCardReconnect

func SCardReconnect(hCard int32, dwShareMode uint32, dwPreferredProtocols uint32, dwInitialization uint32, pdwActiveProtocol *uint32) int32

func SCardReleaseContext

func SCardReleaseContext(hContext int32) int32

func SCardSetAttrib

func SCardSetAttrib(hCard int32, dwAttrId uint32, pbAttr *uint8, cbAttrLen uint32) int32

func SCardSetTimeout

func SCardSetTimeout(hContext int32, dwTimeout uint32) int32

func SCardStatus

func SCardStatus(hCard int32, mszReaderNames string, pcchReaderLen *uint32, pdwState *uint32, pdwProtocol *uint32, pbAtr *uint8, pcbAtrLen *uint32) int32

func SCardTransmit

func SCardTransmit(hCard int32, pioSendPci *SCARD_IO_REQUEST, pbSendBuffer *uint8, cbSendLength uint32, pioRecvPci *SCARDIOREQUEST, pbRecvBuffer *uint8, pcbRecvLength *uint32) int32

func SCardUnload

func SCardUnload()

func SymbolAvailable

func SymbolAvailable(symbol string) bool

SymbolAvailable reports whether the named C symbol was bound when the library loaded. Calling a generated wrapper whose symbol is unavailable dereferences a nil function variable and panics.

Types

type CFDyLibPointers

type CFDyLibPointers struct {
	PvfWriteFramework   unsafe.Pointer
	PvfInitializePlugin unsafe.Pointer
	PvfIdentifyToken    unsafe.Pointer
	PvfFinalizePlugin   unsafe.Pointer
	PvfGetStatus        unsafe.Pointer
	PvfGetCapabilities  unsafe.Pointer
	PvfExtendedFeature  unsafe.Pointer
	PvfGenerateKeys     unsafe.Pointer
	PvfImportKey        unsafe.Pointer
	PvfExportKey        unsafe.Pointer
	PvfComputeCrypt     unsafe.Pointer
	PvfExtAuthenticate  unsafe.Pointer
	PvfListKeys         unsafe.Pointer
	PvfCreatePIN        unsafe.Pointer
	PvfVerifyPIN        unsafe.Pointer
	PvfChangePIN        unsafe.Pointer
	PvfUnblockPIN       unsafe.Pointer
	PvfListPINs         unsafe.Pointer
	PvfCreateObject     unsafe.Pointer
	PvfDeleteObject     unsafe.Pointer
	PvfWriteObject      unsafe.Pointer
	PvfReadObject       unsafe.Pointer
	PvfListObjects      unsafe.Pointer
	PvfLogoutAll        unsafe.Pointer
	PvfGetChallenge     unsafe.Pointer
}

type LPCFDyLibPointers

type LPCFDyLibPointers = *CFDyLibPointers

LPCFDyLibPointers is an opaque pointer to CFDyLibPointers (C typedef LPCFDyLibPointers).

type LPSCARD_IO_REQUEST

type LPSCARD_IO_REQUEST = *SCARDIOREQUEST

LPSCARD_IO_REQUEST is an opaque pointer to _SCARD_IO_REQUEST (C typedef LPSCARD_IO_REQUEST).

type MSCCertACL

type MSCCertACL = MSCObjectACL

MSCCertACL is an alias for MSCObjectACL (C typedef MSCCertACL).

type MSCCryptInit

type MSCCryptInit struct {
	KeyNum          uint8
	CipherMode      uint8
	CipherDirection uint8
	OptParams       *uint8
	OptParamsSize   uint16
}

type MSCEventWaitInfo

type MSCEventWaitInfo struct {
	ArraySize  uint32
	TokenArray *MSCTokenInfo
	AppData    unsafe.Pointer
	CallBack   unsafe.Pointer
}

type MSCGenKeyParams

type MSCGenKeyParams struct {
	AlgoType         uint8
	KeySize          uint16
	PrivateKeyACL    MSCKeyACL
	PublicKeyACL     MSCKeyACL
	PrivateKeyPolicy MSCKeyPolicy
	PublicKeyPolicy  MSCKeyPolicy
	KeyGenOptions    uint8
	POptParams       *uint8
	OptParamsSize    uint32
}

type MSCInitTokenParams

type MSCInitTokenParams struct {
	TransportKey           [264]uint8
	TransportKeyLen        uint32
	TransportBehavior      uint8
	ObjectMemory           uint32
	NewTransportKey        [264]uint8
	NewTransportKeyLen     uint32
	DefaultCHV             [264]uint8
	DefaultCHVLen          uint32
	DefaultCHVTries        uint8
	DefaultCHVUnblock      [264]uint8
	DefaultCHVUnblockSize  uint32
	DefaultCHVUnblockTries uint8
	CreateObjectACL        uint16
	CreateKeysACL          uint16
	CreatePINsACL          uint16
	MaxNumberKeys          uint8
	MaxNumberPINs          uint8
	MaxNumberObjects       uint16
}

type MSCKeyACL

type MSCKeyACL struct {
	ReadPermission  uint16
	WritePermission uint16
	UsePermission   uint16
}

type MSCKeyInfo

type MSCKeyInfo struct {
	KeyNum     uint8
	KeyType    uint8
	KeyPartner uint8
	KeyMapping uint8
	KeySize    uint16
	KeyPolicy  MSCKeyPolicy
	KeyACL     MSCKeyACL
}

type MSCKeyPolicy

type MSCKeyPolicy struct {
	CipherMode      uint16
	CipherDirection uint16
}

type MSCLPCertACL

type MSCLPCertACL = *MSCObjectACL

MSCLPCertACL is an opaque pointer to MSCObjectACL (C typedef MSCLPCertACL).

type MSCLPCryptInit

type MSCLPCryptInit = *MSCCryptInit

MSCLPCryptInit is an opaque pointer to MSCCryptInit (C typedef MSCLPCryptInit).

type MSCLPEventWaitInfo

type MSCLPEventWaitInfo = *MSCEventWaitInfo

MSCLPEventWaitInfo is an opaque pointer to MSCEventWaitInfo (C typedef MSCLPEventWaitInfo).

type MSCLPGenKeyParams

type MSCLPGenKeyParams = *MSCGenKeyParams

MSCLPGenKeyParams is an opaque pointer to MSCGenKeyParams (C typedef MSCLPGenKeyParams).

type MSCLPInitTokenParams

type MSCLPInitTokenParams = *MSCInitTokenParams

MSCLPInitTokenParams is an opaque pointer to MSCInitTokenParams (C typedef MSCLPInitTokenParams).

type MSCLPKeyACL

type MSCLPKeyACL = *MSCKeyACL

MSCLPKeyACL is an opaque pointer to MSCKeyACL (C typedef MSCLPKeyACL).

type MSCLPKeyInfo

type MSCLPKeyInfo = *MSCKeyInfo

MSCLPKeyInfo is an opaque pointer to MSCKeyInfo (C typedef MSCLPKeyInfo).

type MSCLPKeyPolicy

type MSCLPKeyPolicy = *MSCKeyPolicy

MSCLPKeyPolicy is an opaque pointer to MSCKeyPolicy (C typedef MSCLPKeyPolicy).

type MSCLPObjectACL

type MSCLPObjectACL = *MSCObjectACL

MSCLPObjectACL is an opaque pointer to MSCObjectACL (C typedef MSCLPObjectACL).

type MSCLPObjectInfo

type MSCLPObjectInfo = *MSCObjectInfo

MSCLPObjectInfo is an opaque pointer to MSCObjectInfo (C typedef MSCLPObjectInfo).

type MSCLPStatusInfo

type MSCLPStatusInfo = *MSCStatusInfo

MSCLPStatusInfo is an opaque pointer to MSCStatusInfo (C typedef MSCLPStatusInfo).

type MSCLPTokenConnection

type MSCLPTokenConnection = *MSCTokenConnection

MSCLPTokenConnection is an opaque pointer to MSCTokenConnection (C typedef MSCLPTokenConnection).

type MSCLPTokenInfo

type MSCLPTokenInfo = *MSCTokenInfo

MSCLPTokenInfo is an opaque pointer to MSCTokenInfo (C typedef MSCLPTokenInfo).

type MSCObjectACL

type MSCObjectACL struct {
	ReadPermission   uint16
	WritePermission  uint16
	DeletePermission uint16
}

type MSCObjectInfo

type MSCObjectInfo struct {
	ObjectID   [16]int8
	ObjectSize uint32
	ObjectACL  MSCObjectACL
}

type MSCStatusInfo

type MSCStatusInfo struct {
	AppVersion  uint16
	SwVersion   uint16
	FreeMemory  uint32
	TotalMemory uint32
	UsedPINs    uint8
	UsedKeys    uint8
	LoggedID    uint16
}

type MSCTokenConnection

type MSCTokenConnection struct {
	HContext       int32
	HCard          int32
	IoType         *SCARDIOREQUEST
	PMac           [128]uint8
	MacSize        uint32
	TokenLibHandle unsafe.Pointer
	LibPointers    CFDyLibPointers
	TokenInfo      MSCTokenInfo
	LoggedIDs      uint8
	ShareMode      uint32
	RwCallback     unsafe.Pointer
}

type MSCTokenInfo

type MSCTokenInfo struct {
	TokenName     [150]int8
	SlotName      [52]int8
	SvProvider    [200]int8
	TokenId       [33]uint8
	TokenApp      [64]uint8
	TokenAppLen   uint32
	TokenIdLength uint32
	TokenState    uint32
	TokenType     uint32
	AddParams     unsafe.Pointer
	AddParamsSize uint32
}

type PSCARD_IO_REQUEST

type PSCARD_IO_REQUEST = *SCARDIOREQUEST

PSCARD_IO_REQUEST is an opaque pointer to _SCARD_IO_REQUEST (C typedef PSCARD_IO_REQUEST).

type SCARDIOREQUEST

type SCARDIOREQUEST struct {
	DwProtocol  uint32
	CbPciLength uint32
}

Protocol Control Information (PCI) C struct: _SCARD_IO_REQUEST

type SCARD_IO_REQUEST

type SCARD_IO_REQUEST = SCARDIOREQUEST

SCARD_IO_REQUEST is an alias for _SCARD_IO_REQUEST (C typedef SCARD_IO_REQUEST).

func G_rgSCardRawPci

func G_rgSCardRawPci() SCARD_IO_REQUEST

func G_rgSCardT0Pci

func G_rgSCardT0Pci() SCARD_IO_REQUEST

func G_rgSCardT1Pci

func G_rgSCardT1Pci() SCARD_IO_REQUEST

type SCARD_READERSTATE_A

type SCARD_READERSTATE_A struct {
	SzReader       string
	PvUserData     unsafe.Pointer
	DwCurrentState uint32
	DwEventState   uint32
	CbAtr          uint32
	RgbAtr         [33]uint8
}

Jump to

Keyboard shortcuts

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