Skip to content

Instantly share code, notes, and snippets.

Jakub Jelen Jakuje

View GitHub Profile
View cardos-5.3.patch
diff --git a/src/libopensc/asn1.c b/src/libopensc/asn1.c
index ad841934..9a077d3a 100644
--- a/src/libopensc/asn1.c
+++ b/src/libopensc/asn1.c
@@ -1506,7 +1506,7 @@ static int asn1_decode_entry(sc_context_t *ctx,struct sc_asn1_entry *entry,
case SC_ASN1_INTEGER:
case SC_ASN1_ENUMERATED:
if (parm != NULL) {
- r = sc_asn1_decode_integer(obj, objlen, (int *) entry->parm, 0);
+ r = sc_asn1_decode_integer(obj, objlen, (int *)entry->parm, 0);
View example_0XX.php
<?php
//============================================================+
// File name : example_0XX.php
// Begin : 2020-04-10
// Last Update : 2020-04-10
//
// Description : Example 0XX for TCPDF class
// Transactions bug
//
// Author: Jakub Jelen
View gist:4ec5e9f254261dad2c030159ac01db94
P:53015; T:0x140670088165184 22:42:32.449 [opensc-pkcs11] mechanism.c:250:sc_pkcs11_sign_init: called
P:53015; T:0x140670088165184 22:42:32.449 [opensc-pkcs11] mechanism.c:255:sc_pkcs11_sign_init: mechanism 0x3, key-type 0x0
P:53015; T:0x140670088165184 22:42:32.449 [opensc-pkcs11] misc.c:268:session_start_operation: called
P:53015; T:0x140670088165184 22:42:32.449 [opensc-pkcs11] misc.c:269:session_start_operation: Session 0x100bdb0, type 1
P:53015; T:0x140670088165184 22:42:32.449 [opensc-pkcs11] mechanism.c:376:sc_pkcs11_signature_init: called
P:53015; T:0x140670088165184 22:42:32.449 [opensc-pkcs11] mechanism.c:430:sc_pkcs11_signature_init: returning with: 0 (Success)
P:53015; T:0x140670088165184 22:42:32.449 [opensc-pkcs11] mechanism.c:283:sc_pkcs11_sign_init: returning with: 0 (Success)
P:53015; T:0x140670088165184 22:42:32.449 [opensc-pkcs11] pkcs11-object.c:679:C_SignInit: C_SignInit() = CKR_OK
P:53015; T:0x140670088165184 22:42:32.449 [opensc-pkcs11] framework-pkcs15.c:3676:pkcs15_prkey_get_attribute
View opensc_idprime2.patch
diff --git a/src/libopensc/card-idprime.c b/src/libopensc/card-idprime.c
index 7f71b789..57fe8b8f 100644
--- a/src/libopensc/card-idprime.c
+++ b/src/libopensc/card-idprime.c
@@ -188,7 +188,7 @@ static int idprime_process_index(sc_card_t *card, idprime_private_data_t *priv,
&& start[7] == 0x30) {
new_object.fd++;
/* The key reference is one bigger than the value found here for some reason */
- new_object.key_reference = start[8] + 1;
+ new_object.key_reference = 0x11;
View openssh_sig_alg_dump.patch
diff --git a/ssh-rsa.c b/ssh-rsa.c
index 6e2bba0d..b82045e2 100644
--- a/ssh-rsa.c
+++ b/ssh-rsa.c
@@ -232,6 +232,7 @@ ssh_rsa_verify(const struct sshkey *key,
ret = SSH_ERR_KEY_TYPE_MISMATCH;
goto out;
}
+ debug("Verifying signature with ktype=%s and hash_alg=%d", ktype, hash_alg);
if (sshbuf_get_string(b, &sigblob, &len) != 0) {
View uninitialized_asepcos.log
[opensc-pkcs11] ctx.c:790:sc_context_create: ===================================
[opensc-pkcs11] ctx.c:791:sc_context_create: opensc version: 0.16.0
[opensc-pkcs11] reader-pcsc.c:754:pcsc_init: PC/SC options: connect_exclusive=0 disconnect_action=1 transaction_end_action=0 reconnect_action=0 enable_pinpad=1 enable_pace=1
[opensc-pkcs11] reader-pcsc.c:1154:pcsc_detect_readers: called
[opensc-pkcs11] reader-pcsc.c:1168:pcsc_detect_readers: Probing PC/SC readers
[opensc-pkcs11] reader-pcsc.c:1196:pcsc_detect_readers: Establish PC/SC context
[opensc-pkcs11] reader-pcsc.c:1243:pcsc_detect_readers: Found new PC/SC reader 'OMNIKEY AG CardMan 3021 00 00'
[opensc-pkcs11] reader-pcsc.c:303:refresh_attributes: OMNIKEY AG CardMan 3021 00 00 check
[opensc-pkcs11] reader-pcsc.c:331:refresh_attributes: current state: 0x00080122
[opensc-pkcs11] reader-pcsc.c:332:refresh_attributes: previous state: 0x00000000
@Jakuje
Jakuje / README.md
Last active Jun 22, 2020
OpenSC test Sign, Verify, Encipher and Decipher from commandline with OpenSSL CLI
View README.md
export PIN=111111
export SIGN_KEY=11
export ENC_KEY=55

Sign/Verify using private key/certificate

  • Create a data to sign

    echo "data to sign (max 100 bytes)" > data
    
View opensc-tool-serial-all.log
0x7fbb8f041700 09:52:11.092 [opensc-tool] ctx.c:664:process_config_file: scconf_parse failed: Unable to open "/usr/local/etc/opensc.conf": No such file or directory
0x7fbb8f041700 09:52:11.092 [opensc-tool] ctx.c:789:sc_context_create: ===================================
0x7fbb8f041700 09:52:11.092 [opensc-tool] ctx.c:790:sc_context_create: opensc version: 0.16.0
0x7fbb8f041700 09:52:11.092 [opensc-tool] reader-pcsc.c:754:pcsc_init: PC/SC options: connect_exclusive=0 disconnect_action=1 transaction_end_action=0 reconnect_action=0 enable_pinpad=1 enable_pace=1
0x7fbb8f041700 09:52:11.093 [opensc-tool] reader-pcsc.c:1154:pcsc_detect_readers: called
0x7fbb8f041700 09:52:11.093 [opensc-tool] reader-pcsc.c:1168:pcsc_detect_readers: Probing PC/SC readers
0x7fbb8f041700 09:52:11.093 [opensc-tool] reader-pcsc.c:1196:pcsc_detect_readers: Establish PC/SC context
0x7fbb8f041700 09:52:11.102 [opensc-tool] reader-pcsc.c:1243:pcsc_detect_readers: Found new PC/SC reader 'OMNIKEY AG CardMan 3121 00 00'
0x7fbb8f041700 09:52:1
View mcrd_coolkey.log
0x7f1953507700 19:15:57.751 [opensc-pkcs11] ctx.c:790:sc_context_create: ===================================
0x7f1953507700 19:15:57.751 [opensc-pkcs11] ctx.c:791:sc_context_create: opensc version: 0.16.0
0x7f1953507700 19:15:57.752 [opensc-pkcs11] reader-pcsc.c:754:pcsc_init: PC/SC options: connect_exclusive=0 disconnect_action=1 transaction_end_action=0 reconnect_action=0 enable_pinpad=1 enable_pace=1
0x7f1953507700 19:15:57.752 [opensc-pkcs11] reader-pcsc.c:1154:pcsc_detect_readers: called
0x7f1953507700 19:15:57.752 [opensc-pkcs11] reader-pcsc.c:1168:pcsc_detect_readers: Probing PC/SC readers
0x7f1953507700 19:15:57.752 [opensc-pkcs11] reader-pcsc.c:1196:pcsc_detect_readers: Establish PC/SC context
0x7f1953507700 19:15:57.765 [opensc-pkcs11] reader-pcsc.c:1243:pcsc_detect_readers: Found new PC/SC reader 'OMNIKEY AG CardMan 3121 00 00'
0x7f1953507700 19:15:57.765 [opensc-pkcs11] reader-pcsc.c:303:refresh_attributes: OMNIKEY AG CardMan 3121 00 00 check
0x7f1953507700 19:15:57.765 [opensc-pkcs11] reader-pcsc
View WaitForSlotEvent with (piv, coolkey)
0x7f8a6742e700 09:39:20.355 [opensc-pkcs11] pkcs11-global.c:646:C_WaitForSlotEvent: C_WaitForSlotEvent(block=1)
0x7f8a6742e700 09:39:20.355 [opensc-pkcs11] slot.c:488:slot_find_changed: called
0x7f8a6742e700 09:39:20.355 [opensc-pkcs11] slot.c:359:card_detect_all: Detect all cards
0x7f8a6742e700 09:39:20.355 [opensc-pkcs11] slot.c:224:card_detect: OMNIKEY AG CardMan 3121 00 00: Detecting smart card
0x7f8a6742e700 09:39:20.355 [opensc-pkcs11] sc.c:271:sc_detect_card_presence: called
0x7f8a6742e700 09:39:20.355 [opensc-pkcs11] reader-pcsc.c:397:pcsc_detect_card_presence: called
0x7f8a6742e700 09:39:20.355 [opensc-pkcs11] reader-pcsc.c:303:refresh_attributes: OMNIKEY AG CardMan 3121 00 00 check
0x7f8a6742e700 09:39:20.355 [opensc-pkcs11] reader-pcsc.c:323:refresh_attributes: returning with: 0 (Success)
0x7f8a6742e700 09:39:20.355 [opensc-pkcs11] reader-pcsc.c:402:pcsc_detect_card_presence: returning with: 0 (Success)
0x7f8a6742e700 09:39:20.355 [opensc-pkcs11] sc.c:276:sc_detect_card_presence: returning with: 0
You can’t perform that action at this time.