good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
2625057f
Commit
2625057f
authored
Mar 22, 2019
by
Guillaume Ballet
Browse files
Options
Downloads
Patches
Plain Diff
Achieve full transaction signature+sending
parent
189a0329
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
vendor/github.com/gballet/go-libpcsclite/winscard.go
+18
-0
18 additions, 0 deletions
vendor/github.com/gballet/go-libpcsclite/winscard.go
with
18 additions
and
0 deletions
vendor/github.com/gballet/go-libpcsclite/winscard.go
+
18
−
0
View file @
2625057f
...
...
@@ -34,6 +34,7 @@ import (
"encoding/binary"
"fmt"
"net"
"sync"
"unsafe"
)
...
...
@@ -47,6 +48,8 @@ type Client struct {
ctx
uint32
mutex
sync
.
Mutex
readerStateDescriptors
[
MaxReaderStateDescriptors
]
ReaderState
}
...
...
@@ -117,6 +120,9 @@ func EstablishContext(scope uint32) (*Client, error) {
// ReleaseContext tells the daemon that the client will no longer
// need the context.
func
(
client
*
Client
)
ReleaseContext
()
error
{
client
.
mutex
.
Lock
()
defer
client
.
mutex
.
Unlock
()
data
:=
[
8
]
byte
{}
binary
.
LittleEndian
.
PutUint32
(
data
[
:
],
client
.
ctx
)
binary
.
LittleEndian
.
PutUint32
(
data
[
4
:
],
SCardSuccess
)
...
...
@@ -183,6 +189,9 @@ func getReaderState(data []byte) (ReaderState, error) {
// ListReaders gets the list of readers from the daemon
func
(
client
*
Client
)
ListReaders
()
([]
string
,
error
)
{
client
.
mutex
.
Lock
()
defer
client
.
mutex
.
Unlock
()
err
:=
messageSendWithHeader
(
CommandGetReaderState
,
client
.
conn
,
[]
byte
{})
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -230,6 +239,9 @@ type Card struct {
// Connect asks the daemon to connect to the card
func
(
client
*
Client
)
Connect
(
name
string
,
shareMode
uint32
,
preferredProtocol
uint32
)
(
*
Card
,
error
)
{
client
.
mutex
.
Lock
()
defer
client
.
mutex
.
Unlock
()
request
:=
make
([]
byte
,
ReaderStateNameLength
+
4
*
6
)
binary
.
LittleEndian
.
PutUint32
(
request
,
client
.
ctx
)
copy
(
request
[
SCardConnectReaderNameOffset
:
],
[]
byte
(
name
))
...
...
@@ -289,6 +301,9 @@ const (
// Transmit sends request data to a card and returns the response
func
(
card
*
Card
)
Transmit
(
adpu
[]
byte
)
([]
byte
,
*
SCardIoRequest
,
error
)
{
card
.
client
.
mutex
.
Lock
()
defer
card
.
client
.
mutex
.
Unlock
()
request
:=
[
TransmitRequestLength
]
byte
{}
binary
.
LittleEndian
.
PutUint32
(
request
[
:
],
card
.
handle
)
binary
.
LittleEndian
.
PutUint32
(
request
[
4
:
]
/*card.activeProto*/
,
2
)
...
...
@@ -346,6 +361,9 @@ func (card *Card) Transmit(adpu []byte) ([]byte, *SCardIoRequest, error) {
// Disconnect tells the PCSC daemon that the client is no longer
// interested in communicating with the card.
func
(
card
*
Card
)
Disconnect
(
disposition
uint32
)
error
{
card
.
client
.
mutex
.
Lock
()
defer
card
.
client
.
mutex
.
Unlock
()
data
:=
[
12
]
byte
{}
binary
.
LittleEndian
.
PutUint32
(
data
[
:
],
card
.
handle
)
binary
.
LittleEndian
.
PutUint32
(
data
[
4
:
],
disposition
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment