Commit ec107441 authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Fix setting/changing the Reset Code of OpenPGP v2 cards

For setting the Reset Code one needs to add the "--reset" flag to
the PASSWD command.
parent 549b08ed
Pipeline #31749 passed with stage
in 34 minutes and 53 seconds
...@@ -103,6 +103,15 @@ void ChangePinCommand::Private::changePin() ...@@ -103,6 +103,15 @@ void ChangePinCommand::Private::changePin()
qCDebug(KLEOPATRA_LOG) << "ChangePinCommand::changePin()"; qCDebug(KLEOPATRA_LOG) << "ChangePinCommand::changePin()";
QByteArrayList command; QByteArrayList command;
command << "SCD PASSWD"; command << "SCD PASSWD";
if (keyRef == OpenPGPCard::resetCodeKeyRef()) {
// special handling for setting/changing the Reset Code of OpenPGP v2 cards
const auto card = ReaderStatus::instance()->getCard<OpenPGPCard>(serialNumber());
const std::string firstTwoVersionChars = card->cardVersion().substr(0, 2);
const bool isVersion2 = !(firstTwoVersionChars == "1." || firstTwoVersionChars == "0.");
if (isVersion2) {
command << "--reset";
}
}
command << QByteArray::fromStdString(keyRef); command << QByteArray::fromStdString(keyRef);
ReaderStatus::mutableInstance()->startSimpleTransaction(command.join(' '), q, "slotResult"); ReaderStatus::mutableInstance()->startSimpleTransaction(command.join(' '), q, "slotResult");
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment