Yubikey 5 NFC generate OTP in Python with ACR122U












0















For a project I'm currently working on I need to be able to read the new Yubikey 5 NFC keys and generate a Yubico OTP.



Earlier I've managed to get Yubikey NEO to work by using Pyscard library in Python and performing the 2 following APDU commands:



[0x00, 0xA4, 0x04, 0x00, 0x08, 0xA0, 0x00, 0x00, 0x05, 0x27, 0x20, 0x01, 0x01]

[0x00, 0x02, 0x30, 0x00, 0x00]


This still works for Yubikey NEO, it gives me the public ID and One Time Password of the Yubikey.



However for Yubikey 5 this doesn't seem to work. Can anyone point me in the right direction?



I'm using Python on Windows/Mac with the ACR122u NFC/RFID reader via USB.



Edit:



With opensc-tool on MacOS I have identified the Yubikey 5 NFC to be a OpenPGP card v2.1 different from the Personal Identity Verification card (Yubikey NEO).
the guide on https://g10code.com/docs/openpgp-card-2.1.pdf is not helping me further towards generating One Time Passwords.










share|improve this question

























  • Do they have same configuration for NDEF? support.yubico.com/support/solutions/articles/…

    – Korvspad
    Nov 28 '18 at 13:36













  • yes @Korvspad they have the same NDEF config: Configuration slot 1 Don't use access code

    – Niels Jan van de Pol
    Nov 29 '18 at 11:45


















0















For a project I'm currently working on I need to be able to read the new Yubikey 5 NFC keys and generate a Yubico OTP.



Earlier I've managed to get Yubikey NEO to work by using Pyscard library in Python and performing the 2 following APDU commands:



[0x00, 0xA4, 0x04, 0x00, 0x08, 0xA0, 0x00, 0x00, 0x05, 0x27, 0x20, 0x01, 0x01]

[0x00, 0x02, 0x30, 0x00, 0x00]


This still works for Yubikey NEO, it gives me the public ID and One Time Password of the Yubikey.



However for Yubikey 5 this doesn't seem to work. Can anyone point me in the right direction?



I'm using Python on Windows/Mac with the ACR122u NFC/RFID reader via USB.



Edit:



With opensc-tool on MacOS I have identified the Yubikey 5 NFC to be a OpenPGP card v2.1 different from the Personal Identity Verification card (Yubikey NEO).
the guide on https://g10code.com/docs/openpgp-card-2.1.pdf is not helping me further towards generating One Time Passwords.










share|improve this question

























  • Do they have same configuration for NDEF? support.yubico.com/support/solutions/articles/…

    – Korvspad
    Nov 28 '18 at 13:36













  • yes @Korvspad they have the same NDEF config: Configuration slot 1 Don't use access code

    – Niels Jan van de Pol
    Nov 29 '18 at 11:45
















0












0








0


1






For a project I'm currently working on I need to be able to read the new Yubikey 5 NFC keys and generate a Yubico OTP.



Earlier I've managed to get Yubikey NEO to work by using Pyscard library in Python and performing the 2 following APDU commands:



[0x00, 0xA4, 0x04, 0x00, 0x08, 0xA0, 0x00, 0x00, 0x05, 0x27, 0x20, 0x01, 0x01]

[0x00, 0x02, 0x30, 0x00, 0x00]


This still works for Yubikey NEO, it gives me the public ID and One Time Password of the Yubikey.



However for Yubikey 5 this doesn't seem to work. Can anyone point me in the right direction?



I'm using Python on Windows/Mac with the ACR122u NFC/RFID reader via USB.



Edit:



With opensc-tool on MacOS I have identified the Yubikey 5 NFC to be a OpenPGP card v2.1 different from the Personal Identity Verification card (Yubikey NEO).
the guide on https://g10code.com/docs/openpgp-card-2.1.pdf is not helping me further towards generating One Time Passwords.










share|improve this question
















For a project I'm currently working on I need to be able to read the new Yubikey 5 NFC keys and generate a Yubico OTP.



Earlier I've managed to get Yubikey NEO to work by using Pyscard library in Python and performing the 2 following APDU commands:



[0x00, 0xA4, 0x04, 0x00, 0x08, 0xA0, 0x00, 0x00, 0x05, 0x27, 0x20, 0x01, 0x01]

[0x00, 0x02, 0x30, 0x00, 0x00]


This still works for Yubikey NEO, it gives me the public ID and One Time Password of the Yubikey.



However for Yubikey 5 this doesn't seem to work. Can anyone point me in the right direction?



I'm using Python on Windows/Mac with the ACR122u NFC/RFID reader via USB.



Edit:



With opensc-tool on MacOS I have identified the Yubikey 5 NFC to be a OpenPGP card v2.1 different from the Personal Identity Verification card (Yubikey NEO).
the guide on https://g10code.com/docs/openpgp-card-2.1.pdf is not helping me further towards generating One Time Passwords.







python apdu yubico pyscard






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '18 at 12:03







Niels Jan van de Pol

















asked Nov 21 '18 at 12:47









Niels Jan van de PolNiels Jan van de Pol

12




12













  • Do they have same configuration for NDEF? support.yubico.com/support/solutions/articles/…

    – Korvspad
    Nov 28 '18 at 13:36













  • yes @Korvspad they have the same NDEF config: Configuration slot 1 Don't use access code

    – Niels Jan van de Pol
    Nov 29 '18 at 11:45





















  • Do they have same configuration for NDEF? support.yubico.com/support/solutions/articles/…

    – Korvspad
    Nov 28 '18 at 13:36













  • yes @Korvspad they have the same NDEF config: Configuration slot 1 Don't use access code

    – Niels Jan van de Pol
    Nov 29 '18 at 11:45



















Do they have same configuration for NDEF? support.yubico.com/support/solutions/articles/…

– Korvspad
Nov 28 '18 at 13:36







Do they have same configuration for NDEF? support.yubico.com/support/solutions/articles/…

– Korvspad
Nov 28 '18 at 13:36















yes @Korvspad they have the same NDEF config: Configuration slot 1 Don't use access code

– Niels Jan van de Pol
Nov 29 '18 at 11:45







yes @Korvspad they have the same NDEF config: Configuration slot 1 Don't use access code

– Niels Jan van de Pol
Nov 29 '18 at 11:45














0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53412366%2fyubikey-5-nfc-generate-otp-in-python-with-acr122u%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53412366%2fyubikey-5-nfc-generate-otp-in-python-with-acr122u%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

ComboBox Display Member on multiple fields

Is it possible to collect Nectar points via Trainline?