Re: Add Private Keys in System Store MY

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


Date: Tue, 18 Oct 2005 13:01:17 -0400

Whoops, I should correct myself now (since you didn't ;-)
The format you originally refer to in your post:
  --- BEGIN RSA PRIVATE KEY
is NOT pkcs#8 format (as you would see from that pemformats.txt link) but is
in OpenSSL's "Traditional SSLeay RSAPrivateKey format".

You can use Openssl to convert that format *to PKCS#8 format which is THEN suitable for
the PvkConvert utility I refer to below.
See this recent thread for a similar issue:
   http://groups.google.com/group/microsoft.public.dotnet.security/browse_thread/thread/83c34588d92dcbc8/4179820bd894a69e
Sorry for "mal-information" :)

 - Mitch
  "sunit" <sunit@newsgroup.nospam> wrote in message news:Od2IdO%230FHA.1032@TK2MSFTNGP12.phx.gbl...
  ["Michel Gallant"]
  Pardon me for my ignorance as I have never worked in Java
    After going through ur code http://www.jensign.com/JavaScience/PvkConvert
    private static byte[ ] privatekeyinfoToPrivatekeyblob(byte[ ] encodedPrivkey, int keyspec)
    this class returned value will give me the PRIVATEKEYBLOB.

    but u have mentioned in http://www.jensign.com/JavaScience/PEM/pemformats.txt that PvkConvert.java
      is a simply utility Java class which reads a PKCS#8 encoded PrivateKeyInfo file whereas my private
    keys is in PKCS#8 unencrypted private key format. Will it work in my case

    secondly I stored the server.key (the File name in which my Private key is present) and PvkConvert.Java
    in the location C:\jdk1.2.4\bin

    Now i am executing the following command,

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

     I output shown on my screen is :-

     keyspec 1
    java.security.spec.InvalidKeySpecException: Unknown key spec.

    KeySize: 0 bits

    java.lang.NullPointerException

    Pls tell what is wrong in above process.

    Thanking you.

      
 



Relevant Pages

  • Re: CryptAPI(encryption/decryption)
    ... The PFX format encrypts the private key with the user supplied password so ... exchanging private keys using this format is as safe as using the PEM ...
    (microsoft.public.pocketpc.developer)
  • Re: CryptAPI(encryption/decryption)
    ... since symmetric encryption is faster than public key encryption. ... As per your reply I could get the handle of the private key. ... possible for B to decrypt the data using his Private Key. ... The PFX format encrypts the private key with the user supplied password ...
    (microsoft.public.pocketpc.developer)
  • Re: Format of the Public/Private key BLOB
    ... I have a PEM file with private key to decrypt it. ... CryptAPI and Linux using Openssl. ... default DER format? ...
    (microsoft.public.platformsdk.security)
  • Re: CryptAPI(encryption/decryption)
    ... I misspelled the Private Key as Primary Key. ... and the priavte key in PEM format. ... Is there any variation in the encryption format in openssl compared to CSP? ...
    (microsoft.public.pocketpc.developer)
  • Re: CryptAPI(encryption/decryption)
    ... As per your reply I could get the handle of the private key. ... encrypted data and the .pfx file containing the B's private key. ... The PFX format encrypts the private key with the user supplied password so ... exchanging private keys using this format is as safe as using the PEM ...
    (microsoft.public.pocketpc.developer)