Openssl Problem!

5 Beiträge07.11.2007Archiviert
Sub-Zero07.11.2007 · Beitrag #15397
Avatar
Mitglied seit: 27.01.2005
Forenbeiträge: 160
Besuche: 932
Hallo!

Ich versuche derzeit ein Schlüssel mit openssl zu erzeugen.
Zuerst erzeuge ich eine CA. Danach erzeuge ich ein Schlüsselpaar und anschließend signiere ich den schlüssel mit der CA. Das funktioniert auch alles Prima! Mein Problem ist das ich den private key nicht entschlüsseln kann! Ich bekomme als Fehlermeldung:

debian:/usr/lib/ssl/misc/demo# openssl rsa < newreq.pem > key.pem unable to load Private Key 17225:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:644:Expecting: ANY PRIVATE KEY

Hier ein Auszug aus meinem Vorgehen:

[cli]
debian:/usr/lib/ssl/misc/demo# perl CA.pl –newca
CA certificate filename (or enter to create)

Making CA certificate ...
Generating a 1024 bit RSA private key
..........++++++
...........++++++
writing new private key to './demoCA/private/cakey.pem'
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
-----
You are about to be asked to enter information that will be incorporated into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:DE
State or Province Name (full name) [Some-State]:test Locality Name (eg, city) []:test Organization Name (eg, company) [Internet Widgits Pty Ltd]:test Organizational Unit Name (eg, section) []:
Common Name (eg, YOUR name) []:Sub-Zero
Email Address []:[email protected]

Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []:
An optional company name []:
Using configuration from /usr/lib/ssl/openssl.cnf Enter pass phrase for ./demoCA/private/cakey.pem:
Check that the request matches the signature Signature ok Certificate Details:
Serial Number:
dc:a9:ee:fa:92:d3:8a:47
Validity
Not Before: Oct 5 05:31:21 2007 GMT
Not After : Oct 4 05:31:21 2010 GMT
Subject:
countryName = DE
stateOrProvinceName = test
organizationName = test
commonName = Sub-Zero
emailAddress = [email protected]
X509v3 extensions:
X509v3 Subject Key Identifier:
D1:76:0D:6E:4E:4D:9A:0C:46:FF:E5:64:B3:9B:87:AD:BD:C6:13:96
X509v3 Authority Key Identifier:
keyid:D1:76:0D:6E:4E:4D:9A:0C:46:FF:E5:64:B3:9B:87:AD:BD:C6:13:96
DirName:/C=DE/ST=test/O=test/CN=Sub-Zero/[email protected]
serial:DC:A9:EE:FA:92:D3:8A:47

X509v3 Basic Constraints:
CA:TRUE
Certificate is to be certified until Oct 4 05:31:21 2010 GMT (1095 days)

Write out database with 1 new entries
Data Base Updated
debian:/usr/lib/ssl/misc/demo# ls
CA.pl demoCA openssl.cnf
debian:/usr/lib/ssl/misc/demo# perl CA.pl -newreq Generating a 1024 bit RSA private key ..........++++++ ........++++++ writing new private key to 'newkey.pem'
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
-----
You are about to be asked to enter information that will be incorporated into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:DE
State or Province Name (full name) [Some-State]:test Locality Name (eg, city) []:test Organization Name (eg, company) [Internet Widgits Pty Ltd]:test Organizational Unit Name (eg, section) []:
Common Name (eg, YOUR name) []:Sub-Zero
Email Address []:[email protected]

Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []:
An optional company name []:
Request is in newreq.pem, private key is in newkey.pem debian:/usr/lib/ssl/misc/demo# perl CA.pl -sign Using configuration from /usr/lib/ssl/openssl.cnf Enter pass phrase for ./demoCA/private/cakey.pem:
unable to load CA private key
17207:error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt:evp_enc.c:461:
17207:error:0906A065:PEM routines:PEM_do_header:bad decrypt:pem_lib.c:425:
Signed certificate is in newcert.pem
debian:/usr/lib/ssl/misc/demo# perl CA.pl -sign Using configuration from /usr/lib/ssl/openssl.cnf Enter pass phrase for ./demoCA/private/cakey.pem:
Check that the request matches the signature Signature ok Certificate Details:
Serial Number:
dc:a9:ee:fa:92:d3:8a:48
Validity
Not Before: Oct 5 05:32:40 2007 GMT
Not After : Oct 4 05:32:40 2008 GMT
Subject:
countryName = DE
stateOrProvinceName = test
localityName = test
organizationName = test
commonName = Sub-Zero
emailAddress = [email protected]
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
Netscape Comment:
OpenSSL Generated Certificate
X509v3 Subject Key Identifier:
81:24:63:D5:D5:A3:FF:54:BE:2B:2F:56:BC:20:38:49:B1:4E:40:3D
X509v3 Authority Key Identifier:
keyid:D1:76:0D:6E:4E:4D:9A:0C:46:FF:E5:64:B3:9B:87:AD:BD:C6:13:96

Certificate is to be certified until Oct 4 05:32:40 2008 GMT (365 days) Sign the certificate? [y/n]:y


1 out of 1 certificate requests certified, commit? [y/n]y Write out database with 1 new entries Data Base Updated Signed certificate is in newcert.pem

debian:/usr/lib/ssl/misc/demo# openssl rsa < newreq.pem > key.pem unable to load Private Key 17225:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:644:Expecting: ANY PRIVATE KEY


[/cli]

Ich weiß nicht was ich falsch gemacht habe! Ich bin für Tipps dankbar!

Gruß

Sub-Zero
info-man07.11.2007 · Beitrag #15398
Mitglied seit: 04.04.2007
Forenbeiträge: 33
Besuche: 446
openssl rsa < newreq.pem > key.pem


Was soll das sein? Du solltest schon die Syntax von openssl beachten .. -in und -out gibts ja. und openssl rsa alleine wird vermutlich auch nicht reichen?
Sub-Zero08.11.2007 · Beitrag #15399
Avatar
Mitglied seit: 27.01.2005
Forenbeiträge: 160
Besuche: 932
openssl rsa < newreq.pem > key.pem


Was soll das sein? Du solltest schon die Syntax von openssl beachten .. -in und -out gibts ja. und openssl rsa alleine wird vermutlich auch nicht reichen?


Nach 2 Anleitungen die ich befolgt habe, sollte es aber reichen!
<=in;
>=out;

Achso, mit -in und -out habe ich es dann auch probiert. Da es jedoch das selbe darstellt, ist das Ergebnis identisch!

Gruß

Sub-Zero

[Bearbeitet]

Ich habe den Fehler mit Slackware(vorher Debian) reproduzieren können.
Könnte es damit zu tun haben, das beide Systeme virtuelle Maschinen sind?
Debian läuft unter vmware und slackware unter qemu.!

[ Bearbeitet Do, 08. Nov 2007, 10:40 ]
chaosland08.11.2007 · Beitrag #15400
Avatar
Mitglied seit: 24.05.2006
Forenbeiträge: 3
Besuche: 466
schau mal hier
http://mathias-kettner.de/lw_ca_zertifikat_erstellen.html
vieleicht hilft es!
Sub-Zero08.11.2007 · Beitrag #15401
Avatar
Mitglied seit: 27.01.2005
Forenbeiträge: 160
Besuche: 932
Ich habe die Lösung!
Laut meine 2 Anleitungen muss ich folgendes Kommando ausführen:

openssl rsa < newreq.pem > key.pem

Ich habe mir die Dateien etwas genauer angeschaut und festgestellt, dass die newreq.pem nicht die richtige Datei ist!

Korrekt heißt es:

openssl rsa < newkey.pem >key.pem

Anscheinend wurde etwas in der neuesten Version von openssl geändert!

Gruß & Danke!

Sub-Zero