This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @rbin | |
# Install keycard applet | |
gp-select | |
gp-open-secure-channel | |
gp-delete D2760000850101 | |
gp-delete A00000080400010101 | |
gp-delete A00000080400010301 | |
gp-delete A0000008040001 | |
gp-load keycard.cap A0000008040001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn task-queue | |
"Creates `core.async` channel which will process 0 arg functions put there in serial fashon. | |
Takes the same argument/s as `core.async/chan`, those arguments will be delegated to the | |
channel constructor. | |
Returns task-queue where tasks represented by 0 arg task functions can be put for processing." | |
[& args] | |
(let [task-queue (apply async/chan args)] | |
(async/go-loop [task-fn (async/<! task-queue)] | |
(run-task task-fn) | |
(recur (async/<! task-queue))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./keycard shell <<END | |
cash-select | |
cash-sign 0000000000000000000000000000000000000000000000000000000000000000 | |
END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./keycard shell <<END | |
keycard-select | |
keycard-set-secrets 123456 123456789012 KeycardTest | |
keycard-pair | |
keycard-open-secure-channel | |
keycard-verify-pin {{ session_pin }} | |
keycard-remove-key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./keycard shell <<END | |
keycard-select | |
keycard-set-secrets 123456 123456789012 KeycardTest | |
keycard-pair | |
keycard-open-secure-channel | |
keycard-verify-pin {{ session_pin }} | |
keycard-derive-key m/44'/60'/0'/0/0 | |
keycard-sign 0000000000000000000000000000000000000000000000000000000000000000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./keycard shell <<END | |
keycard-select | |
keycard-set-secrets 123456 123456789012 KeycardTest | |
keycard-pair | |
keycard-open-secure-channel | |
keycard-verify-pin {{ session_pin }} | |
keycard-generate-key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./keycard shell <<END | |
keycard-select | |
keycard-set-secrets 123456 123456789012 KeycardTest | |
keycard-pair | |
keycard-open-secure-channel | |
keycard-get-status | |
keycard-verify-pin {{ session_pin }} | |
keycard-unpair {{ session_pairing_index }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./keycard shell <<END | |
# select the keycard applet | |
keycard-select | |
# set the secrets we had from the initialisation | |
keycard-set-secrets 123456 123456789012 KeycardTest | |
# pairing is usually done once per device | |
keycard-pair | |
keycard-open-secure-channel | |
keycard-verify-pin {{ session_pin }} | |
# derive the key we want to use |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./keycard shell <<END | |
# select the keycard applet | |
keycard-select | |
# set the secrets we had from the initialisation | |
keycard-set-secrets 123456 123456789012 KeycardTest | |
# pairing is usually done once per device | |
keycard-pair | |
keycard-open-secure-channel | |
# required for the key generation | |
keycard-verify-pin {{ session_pin }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "base64" | |
STR_SIZE = 131072 | |
TRIES = 8192 | |
str = "a" * STR_SIZE | |
str2 = Base64.strict_encode(str) | |
print "encode #{str[0..3]}... to #{str2[0..3]}...: " |
NewerOlder