📄 sc_lock.3
字号:
.TH sc_lock 3 "April 2003" "OpenSC Programmer's Manual.SH NAMEsc_lock, sc_unlock \- lock or unlock smart card.SH SYNOPSIS.nf.B #include <opensc.h>.sp.BI "int sc_lock(sc_card_t *" card ");.BI "int sc_unlock(sc_card_t *" card ");.fi.SH DESCRIPTIONThese functions handle locking of smart cards, in order to preventconcurrent access to the same card by different users..PPLocking is important to prevent unauthorized access to the cardafter presenting the PIN, for instance..PPAfter a call to \fBsc_lock\fP, concurrent access by other applicationto the same smart card reader is disallowed, provided the readermiddleware supports this (see below). A lock must later be releasedby calling \fBsc_unlock\fP. When disconnecting from the card using\fBsc_disconnect_card\fP, there must not be anymore locks on thecard..PPCalls to \fBsc_lock\fP may be nested, i.e. if \fBsc_lock\fP is calledfive times in a row, the lock will not be released until the fifthcall to \fBsc_unlock\fP..PPNote that these functions do not offer mutual exclusion for differentthreads within the same application process. Multithread locking isthe application's job (Note that the OpenSC PKCS11 module providesMT locking facilities, as that's part of the standard)..SH NOTESWhether locking is effective depends a lot on the middlewareused to talk to the card reader. CTAPI based drivers for instanceperform no interprocess locking at all..PPThe only middleware implementation currently used by OpenSC thatdoes perform this type of locking is PCSC..SH RETURN VALUEIf an error occurred, a negative error code is returned, as describedin \fbsc_error\fP(3). Otherwise, the function will return 0..SH SEE ALSO.BR sc_connect_card (3)..SH AUTHORThis manual page was written by Olaf Kirch <okir@suse.de>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -