How to encrypt the .wky file outside of the Nitrokey HSM

Hey crypto-user,

using the following lines of python I can generate the private key in PEM format as you described:

from Crypto.PublicKey import ECC

# this one is taken from your post "Secret D" 
s_hex = "0E96A352F28DB0A66D39E0ED3E5B06FCD6074D55E07A973B6B872BC267348429"

s_bin = bytes.fromhex(s_hex)
s = int.from_bytes(s_bin, 'big', signed=False)
# "s" is the actual "secret" as integer now 

priv_key = ECC.construct(curve="secp256r1", d=s)
print(priv_key.export_key(format="PEM"))

the last line will then generate/output:

-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgDpajUvKNsKZtOeDt
PlsG/NYHTVXgepc7a4crwmc0hCmhRANCAASZzlwg9AdgBGDbHXFqBOCGT0AD4yZS
qasJkC4YgnRRXNR2NQkkXVw2b3vj0V2WarpKhlu6OlgsEjFEmmwmRNsi
-----END PRIVATE KEY-----

is this what you are looking for?

edit: the actual curve might not be the correct one, took secp256r1 here