Hello,

I have done support of key generation and key import for OpenPGP at
https://github.com/hongquan/OpenSC-main/commits/openpgp

1. Key generation via openpgp-tool  with the command:
openpgp-tool --verify CHV3 --pin 12345678 --gen-key 3
openpgp-tool --verify CHV3 --pin 12345678 --gen-key 1 --key-len 1024

2. Key generation via pkcs15-init:
pkcs15-init --delete-objects privkey,pubkey --id 3 --generate-key
rsa/2048 --auth-id 3 –verify

There is limitation: pkcs15-init requires new key length to be the same
as existing key.
To generate key with different key length, openpgp-tool is recommended.
pkcs15init also require to explicitly remove existing object. That's
why we have "--delete-objects privkey,pubkey --id 3" in the command.

3. Key import via pkcs15-init tool
pkcs15-init --delete-objects privkey,pubkey --id 3 --store-private-key
quan-key.pem --auth-id 3 --verify-pin --id 3

In which the PEM file is extracted from a p12 file using OpenSSL
(certificate is stripped out):
openssl pkcs12 -in secret-gpg-key.p12 -nocerts -out gpg-key.pem

4. Import pairs of key & certificate from P12 file:
pkcs15-init --delete-objects privkey,pubkey --id 3 --store-private-key
quanngu...@mbm.vn.p12 --format pkcs12 --auth-id 3 –verify-pin

Please help me to review the code.

-- 
Regards,
Quân

Y!IM: ng_hquan_vn

_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to