[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AW: [iaik-jce] Problems while creating a RSAPrivateKey from file



Hello,

This constructor expects an RSA private key wrapped into a PKCS#8
PrivateKeyInfo. For removing any given PEM-base64 encoding you may use an
iaik.utils.ASN1InputStream. However, the prefered way for handling keys is
using KeyFactories. When dealing with private keys they should be stored
encrypted (EncryptedPrivateKeyInfo, or better together with the cert in a
keystore or PKCS#12 file).

Dieter Bratko

-----Ursprüngliche Nachricht-----
Von: iaik-jce-owner@iaik.tu-graz.ac.at
[mailto:iaik-jce-owner@iaik.tu-graz.ac.at]Im Auftrag von Axel Wernicke
Gesendet: Donnerstag, 27. Juli 2000 14:16
An: 'iaik-jce@iaik.at'
Betreff: [iaik-jce] Problems while creating a RSAPrivateKey from file


Hi there,

I'm writing an application which uses https to communicate with a bea
application sever. to establish an ssl connection I've to load a certivicate
(X509) and an private key. Both are stored as so called .pem files,
following

-----BEGIN CERTIFICATE-----
MIICvDCCAiWgAwIBAgICCxowDQYsWSNqYw5gZDwZZb0L
...
m8Z6jENTXzsvCltC0F62OlV5MuJfXQVMavrSy5skqNM=
-----END CERTIFICATE-----

and

-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQDBAyV22zhmXseyvNKg6kUnigsGW4YAMcamXKEA+PbaHfoeBmg1
...
Um27Xpl17ZQMlnVCJsmNAkASKIhFK4F2gA7rgSUAXbcfvN855X/Gf9VXH25xtxYM
NaoMfVhVI99KVD8rxJ4/Fv63nSEj0+65jexnPfa0eQJ8
-----END RSA PRIVATE KEY-----

While I have no problem to read the certificate ( using X509Certificate
publicX509 = new X509Certificate( new FileInputStream( CertFilename )); ),
every try to import the private key fails.
I tried something like

RSAPrivateKey privateKey = new RSAPrivateKey( new FileInputStream(
privateKeyFilename) );

for an input stream as well as for a byte[] containing the file, but even if
I did a base64 decoding for the byte array, it fails saying "No
PrivateKeyInfo"

Any help would be appreciated

Axel
------------------------------
Axel Wernicke
Softwareentwickler

IXOS Anwendungs-Software GmbH	Phone: +49.341.48503.84
Nonnenstraße 39	Fax:      +49.341.48503.99
D-04229 Leipzig	E-Mail: axel.wernicke@ixos-leipzig.de
                                   	World Wide Web: http://www.ixos.de




--
Mailinglist-archive at
http://jcewww.iaik.at/mailarchive/iaik-jce/jcethreads.html

To unsubscribe send an email to listserv@iaik.at with the folowing content:
UNSUBSCRIBE iaik-jce




smime.p7s