Decrypt ZPK using smconsole

43 views
Skip to first unread message

Vishesh

unread,
Dec 30, 2022, 10:25:21 AM12/30/22
to jPOS Users
Hi All,

May be I am repeating some older questions , but went through past thread but did not find exact answer

Can I decrypt "encrypted ZPK" given that I have ZMK using the smconsole tool ?

I received 3 clear components of and successfully get ZMK, also received encrypted ZPK but not sure If can somehow "decrypted ZPK" without HSM 

This is for test environment , and just want to complete development part before provisioning HSM 

Thanks





igor skljar

unread,
Dec 30, 2022, 1:27:46 PM12/30/22
to jPOS Users

Hi
You can use JCESecurityModule and JCEHandler.

smconsole -lmk resources/cfg/lmk.key FK 128 ZMK 01010101010101010101010101010101

JCESecurityModule jcesecmod = new JCESecurityModule("cfg/lmk.key", "com.sun.crypto.provider.SunJCE");
JCEHandler jceHandler = new JCEHandler("com.sun.crypto.provider.SunJCE");
SecureDESKey zmk = new SecureDESKey(SMAdapter.LENGTH_DES3_2KEY, SMAdapter.TYPE_ZMK, "BB187C0E517AF4FDBB187C0E517AF4FD", "8CA64D");

System.out.println("KEYCLEARZMK ==>> " + ISOUtil.hexString(jceHandler.extractDESKeyMaterial(SMAdapter.LENGTH_DES3_2KEY, jcesecmod.decryptFromLMK(zmk))));


пятница, 30 декабря 2022 г. в 17:25:21 UTC+2, Vishesh:
Reply all
Reply to author
Forward
0 new messages