Skip to content

Importing 4096 bit RSA keys from P12 into SmartCard-HSM 4K Mini-SIM Card (3.3) failed with SCSH v3.15.388 #7

@danielliang

Description

@danielliang
Importing key and certificate...
GPError: Card (CARD_INVALID_SW/27264) - "Unexpected SW1/SW2=6A80 (Checking error: Incorrect parameter in the command data field) received" in D:\XXXXX\scsh3.15.388\scsh\sc-hsm\SmartCardHSM.js#1270
    at D:\XXXXX\scsh3.15.388\scsh\sc-hsm\SmartCardHSM.js#1270
    at D:\XXXXX\scsh3.15.388\scsh\sc-hsm\HSMKeyStore.js#300
    at D:\XXXXX\scsh3.15.388\keymanager\keymanager.js#1931
    at D:\XXXXX\scsh3.15.388\keymanager\keymanager.js#2085

This bug should be fixed since v3.15.383 by Issue #5 , so I added "dkek.dumpKeyBLOB(blob);" in "KeyManager.prototype.importPKCS12" for debugging (hiding some infos below):

Values from key blob:
---------------------
Checking the MAC      : Passed
KCV                   : XXXXXXX    [Must match the KCV of the DKEK for import]
Key type              : 5    [5=RSA, 6=RSA-CRT, 12=ECC, 15=AES]
Default Algorithm ID  : 0.4.0.127.0.7.2.2.2.1.2 (10)     [Default algorithm]
Allowed Algorithm IDs :  (0)
Access Conditions     :  (0)    [Not used]
Key OID               :  (0)    [Not used]
Randomize             : XXXXXXXX    [Random data prepended at export]
Key size              : 4096    [Key size in bits (ECC/RSA) or bytes (AES)]
Private Exponent      : 00A230822B41......A6FE9141 (513)
Modulus               : BF00540892CD......A1C90B (512)
Public Exponent       : 010001 (3)

and used "openssl rsa -in keyfile -text" for checking it:

modulus:
    00:bf:00:54:08:92:cd:......:a1:c9:0b
publicExponent: 65537 (0x10001)
privateExponent:
    00:a2:30:82:2b:41:......:a6:fe:91:41

The format of keyblob seems to be OK, I don't know where's wrong...

Below actions work:

  • Importing 2048 bit RSA keys from P12
  • Generating 4096 bit RSA keys on the card, then exporting them, then deleting them from the card, and then importing them

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions