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

Exact APDU command to set the attestation private key? #1

Open
jraynes opened this issue Sep 17, 2019 · 1 comment
Open

Exact APDU command to set the attestation private key? #1

jraynes opened this issue Sep 17, 2019 · 1 comment

Comments

@jraynes
Copy link

jraynes commented Sep 17, 2019

Hello,

In your README you mention a command to set the Attestation Private Key:

/send f0020000#(4cc7cf68911896c8e2f9c8cc2f7f0aa21c6acbba381c109afe9118f6cad90f0b)

When I try to send this command with apdu4j I get an error (both with and without the parentheses):

C:\Users\Justin\Downloads>apdu4j.exe -v -a 00A4040008A0000006472F0001 -a f00200004cc7cf68911896c8e2f9c8cc2f7f0aa21c6acbba381c109afe9118f6cad90f0b00
# Using jnasmartcardio.Smartcardio - JNA2PCSC version 0.2
# ACS ACR1252 1S CL Reader PICC 0
SCardConnect("ACS ACR1252 1S CL Reader PICC 0", T=*) -> T=1, 3B80800101
A>> T=1 (4+0008) 00A40400 08 A0000006472F0001
A<< (0006+2) (8ms) 5532465F5632 9000
SCardDisconnect("ACS ACR1252 1S CL Reader PICC 0", true) tx:13/rx:8
Exception in thread "main" java.lang.IllegalArgumentException: Invalid APDU: length=37, b1=76
        at javax.smartcardio.CommandAPDU.parse(Unknown Source)
        at javax.smartcardio.CommandAPDU.<init>(Unknown Source)
        at apdu4j.SCTool.work(SCTool.java:433)
        at apdu4j.SCTool.main(SCTool.java:367)


C:\Users\Justin\Downloads>apdu4j.exe -v -a 00A4040008A0000006472F0001 -a  f0020000#(4cc7cf68911896c8e2f9c8cc2f7f0aa21c6acbba381c109afe9118f6cad90f0b)
# Using jnasmartcardio.Smartcardio - JNA2PCSC version 0.2
# ACS ACR1252 1S CL Reader PICC 0
SCardConnect("ACS ACR1252 1S CL Reader PICC 0", T=*) -> T=1, 3B80800101
A>> T=1 (4+0008) 00A40400 08 A0000006472F0001
A<< (0006+2) (7ms) 5532465F5632 9000
SCardDisconnect("ACS ACR1252 1S CL Reader PICC 0", true) tx:13/rx:8
Exception in thread "main" java.lang.IllegalArgumentException: Odd number of characters: F0020000#(4CC7CF68911896C8E2F9C8CC2F7F0AA21C6ACBBA381C109AFE9118F6CAD90F0B)
        at apdu4j.HexUtils.decodeHexString_imp(HexUtils.java:51)
        at apdu4j.HexUtils.stringToBin(HexUtils.java:83)
        at apdu4j.SCTool.work(SCTool.java:433)
        at apdu4j.SCTool.main(SCTool.java:367)

Can you please provide the exact APDU command to send here? I imagine the #() has an implied meaning but I'm not sure how to translate it.

@antonio-fr
Copy link

#() means here the data to provide. Looking at the APDU, the Lc field is missing. You need to add the length of the data command, which is 32 bytes= 20 in hexa.
A0020000204cc7cf68911896c8e2f9c8cc2f7f0aa21c6acbba381c109afe9118f6cad90f0b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants