Re: Add Private Keys in System Store MY

From: Michel Gallant (neutron_at_istar.ca)
Date: 10/19/05


Date: Wed, 19 Oct 2005 12:41:35 -0400

Always the details .... :-)
The utility PvkConvert handles PrivateKeyInfo format which is an UNENCRYPTED
private key. It also expects a binary format (not the B64 format).

So to get that unencrypted form from openssl you can use the nocrypt and outform switches; e.g.:

  openssl pkcs8 -in server.key -topk8 -nocrypt -outform DER -out enc8key.pem

Also, you should update your JVM to 1.4.2 (not sure if 1.2.4 Sun JVM supports PKCS#8 )

- Mitch

  "sunit" <sunit@newsgroup.nospam> wrote in message news:eRyCxCL1FHA.3864@TK2MSFTNGP12.phx.gbl...

    ["Michel Gallant"]
    thanx a lot for taking pain to solve my problem
    Sorry to annoy u once again.

    I converted my private keys from Traditional SSLeay RSAPrivateKey format" to PKCS#8

    openssl>pkcs8 -in server.key -topk8 -out private.key
     i followed the same procedure to execute the program.But it gave the same error

    C:\jdk1.2.4\bin\javac PvkConvert.java
    C:\jdk1.2.4\bin\java PvkConvert private.key

    output shown on my screen is :-
     keyspec 1
    java.security.spec.InvalidKeySpecException: Unknown key spec.
    KeySize: 0 bits

    java.lang.NullPointerException

    and my private keys are store in private.key(pkcs#8).The content of this file is:
    ----BEGIN ENCRYPTED PRIVATE KEY-----
    MIICoTAbBgkqhkiG9w0BBQMwDgQI2ep5W6w4Kt8CAggABIICgJgVeg+JFOGfRorc
    LpNhYLZxrlDzkwHHRH2ABWIuPq44vcBYnz+NNt30zOuaE1+cMnnhFPO7MX4clLrI
    cZLUGHbjJRd4JG0ijjOziXtvO5O9f7Owr0vOsIIALcAEH1dgbnjYwZEbIiBck3oZ
    yCAgeS1gP92qmK8lSbW9UNLvlOpn06NNnmanuyB99JB0fQUZszjtOhDA94Zop1WR
    FNHhWXZkiMJPKrq+1NtoJ2lDCkjR1IhsVKzGIjr9HbsqE95jly4XDVAaSM8He7lz
    mj4vYVYNO1m9w18D6h+13GSYLgY6loDmHawIfPhwxdGu1ZACB0uvxd7s0nK/f8b/
    O/F42qlcaxPk2AvxYfiYEs3iE8FdUwrex2L5s/flpBrDMjLWidZmuzSPWQozGsxX
    H8Lp4KDm5QAVd7KY4xtz8XrKE0vnsZJoUxHPVZ1jYb2mztE4m/PgVoLBzXNjbhhI
    ml5e0esIC7kaF/xOIU23LajADFkw+g/yCF+gJhB3N3K3ZLYd8zjZDGQmZjXD78t+
    Ng6/bGFnU9kx0qk8DTkS16O/QjFpSKhRoi0K435233hOJU2ftw1f8cvOYwmWiFxu
    5xumzB61IDqVe60agPlttmOOhOQBwFq0oBY2BR0LZ1kQILYDcsb0+apH/Qnt++B7
    gZt/e6EJ4s2RE1mIj6BKUTv1ocbeSgFzF8MyVZg/mSEps2nQRSjGAD+sc21IW5eB
    BW2O8vFnLyCsevUYTEodoo1nyFJZVtp5BvPFnrDvgnSvzn0lvU6qUsyTk83BB/Cl
    Tycp6xmqLIjHGEvc0pUQ6eAZ4JsA72QRUpuxh1G81d305d4WkUv2F2A1wudQBnmX
    IWGrgpg=
    -----END ENCRYPTED PRIVATE KEY-----

    Pls Help me