LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 05-17-2008, 09:48 PM   #1
sydney-troz
Member
 
Registered: Feb 2007
Distribution: Kubuntu, it's obese barely-usable sibling, Ubuntu
Posts: 142

Rep: Reputation: 15
Problem reading PEM private key in Qt 4.4


Hi

I have recently been learning Qt, and am now working on a project that utilizes its SSL capabilities. I am using OpenSSL 0.9.8 on 64bit Kubuntu Fiesty, with Qt 4.4 compiled with SSL support. When I try reading a private key I created with the openssl command, the QSslKey object is always null. This is strange, because the self-signed certificate I created with the private key in question is read just fine. Below is the code I'm using to load the key.

Code:
QSslKey key(new QFile(filename), QSsl::Rsa);
where filename is a QString containing a filename. The key I'm using (for testing) is:

Code:
-----BEGIN RSA PRIVATE KEY-----
MIICWwIBAAKBgQCyYhZBQEF3dzLJxbtGxLVNIAa3XIb1T+a8zznmZHs2wshtAEcT
DrOG+9CyE6MUmuzkCk2+Sg/2lxJWkVDLn3Gw2qe1LKh/Aapk+snnfSD/Tt49XjwL
P8MU8Y44MW/PkrIe+D1fBlYlPYIbs3w1AcBmvbl6RWgmcBoAnKwRCwbSLQIDAQAB
AoGASkLBRwrL9kL+NreFXlG3tFLX2O/BE1DfGs0eKoa8MLDoJVCPRiTBojkkyW2Z
X5ObeNe9Q7GrcZm0vasjOpG3DxnZ9XR1QJqq+PHwy31wDrZIY/WPa+AWw3l61l+U
c+7DflSmkU9Ul2GFTv+7ltM0YipFP9Lb1bj2jLy8rDm2X6ECQQDhafQohFRObE78
Ulw9K+ddf/g2Bz8aqo0CrA+pOqqk1tw5RYGEZA+nPaxb83HxMzzQMzc4jjlqvzUB
KxRQZmHZAkEAypZ1j//mgRpgmaD+nP7SisDbQAbE4w+LyY3tZUkDTq1R7TDD07FC
S+sVeEtrUMbp2ona0kQll/3ggqdKHhKqdQJAYVguVqj+93cSjSjMKKajHd+7wylR
+SQaDUNc6Aor00/uftUjX5cOo3ygyHzTggRMiOT1Pfk9lnnIXB7MgQQV0QJANg/a
xZfDmnZAix7Uc27pHpACsl5cEj/mzN2sGVhXoppL/6EA0TA/geT1MMnnlIHQjDo3
g98drSbZz+P2unm+tQJAPy61mvQvYLNJHPqEi7SNqjmG+jmlBz260MLpljyF5u7J
SxphezQSFZHMY9E7ojQ0MwmZtptkjAzMw1/dJ7/YpA==
-----END RSA PRIVATE KEY-----
The command I used to create the key:

Code:
openssl genrsa -out key.pem 1024
I tried googling this, but couldn't seem to find anything. I'm not doing anything terribly complex in loading the key, so I'm guessing the problem's not that complicated, but I haven't worked a lot (as a programmer) with cryptography or ssl or qt before, so any suggestions are appreciated!

Thanks,
Syd

Last edited by sydney-troz; 05-18-2008 at 12:28 PM. Reason: thought it might be a good idea to add the key creation command
 
  


Reply

Tags
qt, ssl


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
private key for putty melvinong Linux - Server 2 11-13-2007 05:33 AM
if they got my gpg private key...... qwijibow Linux - Security 1 10-21-2003 12:22 AM
RSA public key encryption/private key decription koningshoed Linux - Security 1 08-08-2002 07:25 AM
private key compromised sourian Linux - Security 4 04-17-2002 06:59 PM


All times are GMT -5. The time now is 02:49 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration