Skip to content

Instantly share code, notes, and snippets.

// color equalization fuuu
int colors = 16;
byte[] r = new byte[colors];
byte[] g = new byte[colors];
byte[] b = new byte[colors];
for (int i = 0; i < colors; i++) {
r[i] = (byte) (i*256/colors & 0xFF);
g[i] = (byte) (i*256/colors & 0xFF);
b[i] = (byte) (i*256/colors & 0xFF);
}
# If you want support for OpenSSL (needed for pkcs15-init tool, software hashing in PKCS#11 library and verification):
# - download and build OpenSSL
# - uncomment the line starting with OPENSSL_DEF
# - set the OPENSSL_INCL_DIR below to your openssl include directory, preceded by "/I"
# - set the OPENSSL_LIB below to your openssl lib file
OPENSSL_DEF= /DENABLE_OPENSSL
!IF "$(OPENSSL_DEF)" == "/DENABLE_OPENSSL"
!IF "$(PLATFORM)" == "x86"
OPENSSL_DIR = C:\OpenSSL-Win32
!ELSE
@lmiguelmh
lmiguelmh / gist:f60acc8da8e26e8d3eff78dc67f93525
Created November 10, 2017 17:38
Dump of the EF.TokenInfo (path 3f0050155032) from an Oberthur ID-One Cosmo v7 (AuthentIC 3.2.2) smart card
C:\Program Files\OpenSC Project\OpenSC\tools>opensc-explorer.exe -v -m 3F00
OpenSC Explorer version 0.17.0
Using reader with a card: Gemplus USB Smart Card Reader 0
OpenSC [3F00]> cd 5015
OpenSC [3F00/5015]> asn 5032
Printing tags for buffer of length 745
30 Univ: tag 0x10, length 741: SEQUENCE
02 Univ: tag 0x02, length 1: INTEGER [1]
0C Univ: tag 0x0C, length 21: UTF8STRING [Oberthur Technologies]
80 Cntx: tag 0x00, length 6: <raw content> [4F5420415750]
@lmiguelmh
lmiguelmh / gist:04203c713ed441a04ba316dfd20fa30d
Created November 14, 2017 15:57
Log for OpenSC with the verification of the mechanism disabled
C:\Program Files\OpenSC Project\OpenSC\tools>pkcs11-tool.exe --module "C:\Program Files\OpenSC Project\OpenSC\pkcs11\opensc-pkcs11.dll" -v -s -m SHA256-RSA-PKCS --id 02 --slot 1 --pin 112233 -i test.txt -o test.signed.txt
Using slot with ID 0x1
Using signature algorithm SHA256-RSA-PKCS
-END-
**opencs-debug.log**
2017-11-13 15:41:32.061 ===================================
2017-11-13 15:41:32.063 opensc version: 0.17.0
2017-11-13 15:41:32.064 PC/SC options: connect_exclusive=0 disconnect_action=1 transaction_end_action=0 reconnect_action=0 enable_pinpad=1 enable_pace=1
@lmiguelmh
lmiguelmh / gist:77a6b8c51dafa42bdeab8e1c98bc7c15
Created November 14, 2017 21:54
Contents of EF 3F0050157002
C:\Program Files\OpenSC Project\OpenSC\tools>opensc-explorer.exe -m 3F00
OpenSC Explorer version 0.17.0
Using reader with a card: Gemplus USB Smart Card Reader 0
OpenSC [3F00]> cd 5015
OpenSC [3F00/5015]> cat 7002
00000000: 30 73 30 4B 0C 1E 43 6C 61 76 65 20 50 72 69 76 0s0K..Clave Priv
00000010: 61 64 61 20 64 65 20 41 75 74 65 6E 74 69 63 61 ada de Autentica
00000020: 63 69 6F 6E 03 02 06 C0 04 01 01 30 22 30 0A 03 cion.......0"0..
00000030: 02 06 40 30 04 03 02 05 20 30 0A 03 02 04 10 30 ..@0.... 0.....0
00000040: 04 03 02 05 20 30 08 03 03 06 00 40 04 01 01 30 .... 0.....@...0
@lmiguelmh
lmiguelmh / gist:c7fe8b31e66fecab602125bec156684e
Last active November 15, 2017 16:20
RAW dump of the EF.TokenInfo (path 3f0050155032) from an Oberthur ID-One Cosmo v7 (AuthentIC 3.2.2) smart card
C:\Program Files\OpenSC Project\OpenSC\tools>opensc-explorer.exe -v -m 3F00
OpenSC Explorer version 0.17.0
Using reader with a card: Gemplus USB Smart Card Reader 0
OpenSC [3F00]> cd 5015
OpenSC [3F00/5015]> cat 5032
00000000: 30 82 02 E5 02 01 01 0C 15 4F 62 65 72 74 68 75 0........Oberthu
00000010: 72 20 54 65 63 68 6E 6F 6C 6F 67 69 65 73 80 06 r Technologies..
00000020: 4F 54 20 41 57 50 03 02 05 60 A2 82 02 A8 30 17 OT AWP...`....0.
00000030: 02 01 01 02 02 02 20 05 00 03 02 01 02 06 05 2B ...... ........+
00000040: 0E 03 02 1A 02 01 01 30 1A 02 01 02 02 01 00 05 .......0........
@lmiguelmh
lmiguelmh / opensc-debug-Windows10.log
Created May 11, 2018 16:24
pkcs11-tool test fails with: C_SignFinal failed CKR_DATA_LEN_RANGE (0x21) in Windows 7
P:2772; T:5776 2018-05-11 11:20:03.233 ===================================
P:2772; T:5776 2018-05-11 11:20:03.234 opensc version: 0.18.0
P:2772; T:5776 2018-05-11 11:20:03.235 PC/SC options: connect_exclusive=0 disconnect_action=0 transaction_end_action=0 reconnect_action=0 enable_pinpad=1 enable_pace=1
P:2772; T:5776 2018-05-11 11:20:03.237 [opensc-pkcs11] reader-pcsc.c:1282:pcsc_detect_readers: called
P:2772; T:5776 2018-05-11 11:20:03.238 Probing PC/SC readers
P:2772; T:5776 2018-05-11 11:20:03.239 Establish PC/SC context
P:2772; T:5776 2018-05-11 11:20:03.242 Adding new PC/SC reader 'Gemplus USB Smart Card Reader 0'
P:2772; T:5776 2018-05-11 11:20:03.243 Gemplus USB Smart Card Reader 0 check
P:2772; T:5776 2018-05-11 11:20:03.244 current state: 0x00010422
P:2772; T:5776 2018-05-11 11:20:03.245 previous state: 0x00000000
@lmiguelmh
lmiguelmh / opensc-debug.log
Created May 11, 2018 16:13
pkcs11-tool test fails with: C_SignFinal failed CKR_DATA_LEN_RANGE (0x21) in Windows 7
P:4700; T:616 2018-05-11 10:31:40.812 ===================================
P:4700; T:616 2018-05-11 10:31:40.812 opensc version: 0.18.0
P:4700; T:616 2018-05-11 10:31:40.812 PC/SC options: connect_exclusive=0 disconnect_action=0 transaction_end_action=0 reconnect_action=0 enable_pinpad=1 enable_pace=1
P:4700; T:616 2018-05-11 10:31:40.812 [opensc-pkcs11] reader-pcsc.c:1282:pcsc_detect_readers: called
P:4700; T:616 2018-05-11 10:31:40.828 Probing PC/SC readers
P:4700; T:616 2018-05-11 10:31:40.828 Establish PC/SC context
P:4700; T:616 2018-05-11 10:31:40.828 Adding new PC/SC reader 'Gemplus USB SmartCard Reader 0'
P:4700; T:616 2018-05-11 10:31:40.828 Gemplus USB SmartCard Reader 0 check
P:4700; T:616 2018-05-11 10:31:40.828 current state: 0x00010122
P:4700; T:616 2018-05-11 10:31:40.828 previous state: 0x00000000
@lmiguelmh
lmiguelmh / sam local invoke log
Created May 21, 2019 22:53
sam local invoke log
$ sam local invoke --debug PyTorchFunction -n env.json -e event.json
2019-05-21 17:44:33 Using SAM Template at <HOME>/aws-lambda/template.yaml
2019-05-21 17:44:33 Changing event name from creating-client-class.iot-data to creating-client-class.iot-data-plane
2019-05-21 17:44:33 Changing event name from before-call.apigateway to before-call.api-gateway
2019-05-21 17:44:33 Changing event name from request-created.machinelearning.Predict to request-created.machine-learning.Predict
2019-05-21 17:44:33 Changing event name from before-parameter-build.autoscaling.CreateLaunchConfiguration to before-parameter-build.auto-scaling.CreateLaunchConfiguration
2019-05-21 17:44:33 Changing event name from before-parameter-build.route53 to before-parameter-build.route-53
2019-05-21 17:44:33 Changing event name from request-created.cloudsearchdomain.Search to request-created.cloudsearch-domain.Search
2019-05-21 17:44:33 Changing event name from docs.*.autoscaling.CreateLaunchConfiguration.complete-section to docs.*.auto-scalin
@lmiguelmh
lmiguelmh / Docker logs for sam local invoke
Created May 21, 2019 22:57
Docker logs for sam local invoke
-- Reboot --
may 21 16:59:47 desktop systemd[1]: Starting Docker Application Container Engine...
may 21 16:59:48 desktop dockerd[1300]: time="2019-05-21T16:59:48.068753765-05:00" level=info msg="systemd-resolved is running, so using resolvconf: /run/systemd/resolve/resolv.conf"
may 21 16:59:48 desktop dockerd[1300]: time="2019-05-21T16:59:48.099138143-05:00" level=info msg="parsed scheme: \"unix\"" module=grpc
may 21 16:59:48 desktop dockerd[1300]: time="2019-05-21T16:59:48.099158867-05:00" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
may 21 16:59:48 desktop dockerd[1300]: time="2019-05-21T16:59:48.099337708-05:00" level=info msg="parsed scheme: \"unix\"" module=grpc
may 21 16:59:48 desktop dockerd[1300]: time="2019-05-21T16:59:48.099354685-05:00" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
may 21 16:59:48 desktop dockerd[1300]: time="2019-05-21T16:59:48.099513707-05:00" level=info msg="ccResolverWrapper: sending new addres