Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update module cunicu.li/go-iso7816 to v0.8.1 #54

Merged
merged 2 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,19 @@ func (c *Card) SetCertificate(key ManagementKey, slot Slot, cert *x509.Certifica
return fmt.Errorf("failed to authenticate with management key: %w", err)
}

// https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-73-4.pdf#page=40
certData, err := tlv.EncodeBER(
tlv.New(tagCertificate, cert.Raw),
tlv.New(tagCertInfo, 0x00), // "for a certificate encoded in uncompressed form CertInfo shall be 0x00"
tlv.New(tagErrorDetectionCode),
)
if err != nil {
return err
}

if _, err := sendTLV(c.tx, insPutData, 0x3f, 0xff,
slot.Object.TagValue(),
tlv.New(0x53,
// https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-73-4.pdf#page=40
tlv.New(tagCertificate, cert.Raw),
tlv.New(tagCertInfo, 0x00), // "for a certificate encoded in uncompressed form CertInfo shall be 0x00"
tlv.New(tagErrorDetectionCode),
),
tlv.New(0x53, certData),
); err != nil {
return fmt.Errorf("failed to execute command: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module cunicu.li/go-piv

go 1.22.2

require cunicu.li/go-iso7816 v0.8.0
require cunicu.li/go-iso7816 v0.8.1

require (
github.com/ebfe/scard v0.0.0-20230420082256-7db3f9b7c8a7 //test-only
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ cunicu.li/go-iso7816 v0.6.0 h1:l0CzHZWN7FFLJOGY1NUQGyRxv0IuZODpMvEHWFIvOz4=
cunicu.li/go-iso7816 v0.6.0/go.mod h1:DBXPMv/k9XQplA9qQT2k/Xo2gPCWQ9/rIh+h4hzJ850=
cunicu.li/go-iso7816 v0.8.0 h1:EEQ9hAbdIbTUM0uVrWbfGnQnFjA3P/VoNj1GM71Tf5w=
cunicu.li/go-iso7816 v0.8.0/go.mod h1:gSG/jc0iH2bykUasCbyIfnI1PFotnm76Gmk1bc7UFEg=
cunicu.li/go-iso7816 v0.8.1 h1:3kgjW+iCwkw6DtLDh5aKUQfwpwd0zoHHyPxyDS9t7HU=
cunicu.li/go-iso7816 v0.8.1/go.mod h1:bt5Uo0kVcv8+wbIaMdWw3YrcwdhGEDCu/arp7dsHuTY=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
7 changes: 6 additions & 1 deletion pin_protected.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,14 @@ func (c *Card) SetPinProtectedData(key ManagementKey, ppd *PinProtectedData) err
return fmt.Errorf("failed to authenticate with key: %w", err)
}

ppdData, err := tlv.EncodeBER(ppd.TagValues...)
if err != nil {
return err
}

if _, err := sendTLV(c.tx, insPutData, 0x3f, 0xff,
doPrinted.TagValue(),
tlv.New(0x53, ppd.TagValues),
tlv.New(0x53, ppdData),
); err != nil {
return fmt.Errorf("failed to execute command: %w", err)
}
Expand Down
Loading