Erk: "Wrong secret key used"

Justin Wienckowski Justin.Wienckowski@trw.com
Wed Jul 25 23:45:01 2001


You all must dread seeing my name in your inbox by now ;)

The good news is the conversion works.  I'm successfully extracting my key =
from a PKCS12 certificate and importing the public and private keys into =
gpg.

The bad news is there's something wrong with the keys.  When encrypt a =
file using the imported key, then try to decrypt it, I get:

gpg: Warning: using insecure memory!
gpg: encrypted with 1024-bit RSA key, ID 082E0A00, created 2001-07-24
      "Justin Wienckowski <Justin.Wienckowski@trw.com>"
gpg: public key decryption failed: wrong secret key used
gpg: decryption failed: secret key not available

Now the *really* odd thing is if I use cryptlib to encrypt/decrypt =
something within my conversion program, it's fine.  But gpg is either =
handling the key data badly or I'm doing something wrong with it.

My assumption is that I'm corrupting the key data somewhere in transit.  =
I.E. that gpg is expecting something that I'm not providing or finding =
something it doesn't like.

Any ideas or suggestions?  I'm kinda clueless even where to being trying =
to figure this one out.

I appreciate any input.  Thanks much!
-Justin



REFERENCE DATA

Import File
-------------

:public key packet:
version 4, algo 1, created 996009714, expires 0 *n* pkey[0]: [1024 bits] *e* pkey[1]: [17 bits]
:user ID packet: "j <j>"
:signature packet: algo 1, keyid 8CF2DA3A082E0A00
version 4, created 996096014, md5len 0, sigclass 13 digest algo 2, begin of digest fb 22 hashed subpkt 2 len 5 (sig created 2001-07-25) hashed subpkt 16 len 9 (issuer key ID 8CF2DA3A082E0A00) data: [1023 bits]
:secret key packet:
version 4, algo 1, created 996009714, expires 0 *n* skey[0]: [1024 bits] *e* skey[1]: [17 bits] *d* skey[2]: [1020 bits] *p* skey[3]: [512 bits] *q* skey[4]: [512 bits] *u* skey[5]: [512 bits] checksum: 9ddb
:user ID packet: "j <j>"
Actual Key Data --------------------- RSA Component N (1024 bits) 96715B16B15A0E6D4C6F21FBD3E668F21E2E95314DD57FD448 975650FFA624A8561EEB193B673C234ED8082F1647B17DBB96 57E9C4E1D2EDDFFFCEC14970CA86EE568EDF8077A00361AFA6 6EC3BDBCB735B9846E2E3214F4A9674F855F9632504E55D7BD A7B6FA9935E6F9321FFEB2986D3ECEC033E6AF320AC97FAA32 5213C9 RSA Component E (17 bits) 010001 RSA Component d (1020 bits) 08217C40CFB9044A97F4F1AB409A9555709827EC103ED7B7CB 6C9277B2397285BE91D136FDE4E875280FB8F1828CC165003C 71E7EA8221FA453EF817AE36705BA152724C5AA90B06374410 FF8BBB306D0B168FAF77F8D772BDC7360E38F60571BCD042AB 82ADA2EDD3A2151A13C88B2D898E1636EF277701A8EAE76024 2471D9 RSA Component p (512 bits) C80C7C22C5074B0EB87F5C4F6FEDDD5FB5955A69221AC263A6 32C82876478E86D94723578174E23CDE89A6B5818D4279D258 9E1773FE43006475F6B7E0E024FB RSA Component q (512 bits) C08513D5F597872B22BC5728F5A7F708085644786C7BF8D492 E4759FC3D9D02E7AD6F1FE8DAC835E09063FD402237498439E 1362D520C9341CD145F1A156E70B RSA Component e1 (512 bits) 9C327B5E9E9EC2313D475C693E08E8F7C90D53A9911279C35A CA7DD471FE0F402538D1548AE51B9CD159834C675A47945CF4 0A845F7221189658310A83D01FAF RSA Component e2 (509 bits) 1B6B58B5E272A067BE5CC0B52EB7AB71536EA5F5D8CD9754FF 4ED689D8A50F076FAB696FEDD1A22C2470E56A569BA221858F E006F57FE3E82E2A8821AFEEE69D RSA Component u (512 bits) 80AB7BDEE0B816569B2024307C1C17B4656F403DDA2B01BBD4 9CF01750A7961AEFE7D93F31B6DA6D421E9409EA83A8E63A47 4E375FEAEC7A7E0A996FA935B7E0