Compare commits
2 Commits
krlnokrl/m
...
nightly-ma
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ad7e3a610 | ||
|
|
25889094e5 |
Submodule pico-keys-sdk updated: 87e9f9e58b...7abedc5b0e
@@ -9,6 +9,7 @@ CONFIG_TINYUSB_TASK_STACK_SIZE=16384
|
|||||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="pico-keys-sdk/config/esp32/partitions.csv"
|
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="pico-keys-sdk/config/esp32/partitions.csv"
|
||||||
CONFIG_PARTITION_TABLE_FILENAME="pico-keys-sdk/config/esp32/partitions.csv"
|
CONFIG_PARTITION_TABLE_FILENAME="pico-keys-sdk/config/esp32/partitions.csv"
|
||||||
|
CONFIG_PARTITION_TABLE_OFFSET=0x10000
|
||||||
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
|
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
|
||||||
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
|
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
|
||||||
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
|
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
|
||||||
|
|||||||
@@ -172,12 +172,6 @@ def parse_args():
|
|||||||
parser_bip32_sign.add_argument('--file-in', help='File to sign.')
|
parser_bip32_sign.add_argument('--file-in', help='File to sign.')
|
||||||
parser_bip32_sign.add_argument('--file-out', help='File to write the signature.')
|
parser_bip32_sign.add_argument('--file-out', help='File to write the signature.')
|
||||||
|
|
||||||
parser_pubkey = subparser.add_parser('pubkey', help='Retrieves the public key of a private key.')
|
|
||||||
parser_pubkey.add_argument('-k', '--key', help='The private key index', metavar='KEY_ID', required=True)
|
|
||||||
parser_pubkey.add_argument('--format', choices=['PEM', 'DER', 'OpenSSH'], default='PEM', help='The output format of the public key')
|
|
||||||
parser_pubkey.add_argument('--file-out', help='File to write the public key.')
|
|
||||||
parser_pubkey.add_argument('--curve', choices=['secp192r1', 'secp256r1', 'secp384r1', 'secp521r1', 'brainpoolP256r1', 'brainpoolP384r1', 'brainpoolP512r1', 'secp192k1', 'secp256k1'], help='The curve of the public key. [Required for ECDSA keys]')
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
return args
|
return args
|
||||||
|
|
||||||
@@ -551,19 +545,6 @@ def parse_derivation_path(path):
|
|||||||
e = e[:-1]
|
e = e[:-1]
|
||||||
indices.append(int(e) + off)
|
indices.append(int(e) + off)
|
||||||
return indices
|
return indices
|
||||||
def pubkey(picohsm, args):
|
|
||||||
kid = int(args.key)
|
|
||||||
res = picohsm.public_key(kid, args.curve)
|
|
||||||
key_dat = res.public_bytes(
|
|
||||||
encoding=Encoding.PEM if args.format == 'PEM' else Encoding.DER if args.format == 'DER' else Encoding.OpenSSH,
|
|
||||||
format=PublicFormat.SubjectPublicKeyInfo if args.format in ['PEM', 'DER'] else PublicFormat.OpenSSH)
|
|
||||||
if (args.file_out):
|
|
||||||
fout = open(args.file_out, 'wb')
|
|
||||||
else:
|
|
||||||
fout = sys.stdout.buffer
|
|
||||||
fout.write(key_dat if args.format == 'PEM' or args.format == 'OpenSSH' else bytes(key_dat))
|
|
||||||
if (args.file_out):
|
|
||||||
fout.close()
|
|
||||||
|
|
||||||
def main(args):
|
def main(args):
|
||||||
sys.stderr.buffer.write(b'Pico HSM Tool v2.4\n')
|
sys.stderr.buffer.write(b'Pico HSM Tool v2.4\n')
|
||||||
@@ -601,12 +582,10 @@ def main(args):
|
|||||||
memory(picohsm, args)
|
memory(picohsm, args)
|
||||||
elif (args.command == 'bip32'):
|
elif (args.command == 'bip32'):
|
||||||
bip32(picohsm, args)
|
bip32(picohsm, args)
|
||||||
elif (args.command == 'pubkey'):
|
|
||||||
pubkey(picohsm, args)
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
main(args)
|
main(args)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
run()
|
run()
|
||||||
|
|||||||
Reference in New Issue
Block a user