# OpenSSL private key error

**URL:** <https://www.ruby-forum.com/t/openssl-private-key-error/143661>\
**Category:** Rails\
**Created:** [July 21, 2008, 5:30pm UTC](https://www.ruby-forum.com/t/openssl-private-key-error/143661 "2008-07-21T17:30:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![traceyz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f04885/32.png) [@traceyz](https://www.ruby-forum.com/u/traceyz)\
**Post date:** [July 21, 2008, 5:30pm UTC](https://www.ruby-forum.com/t/openssl-private-key-error/143661/1 "2008-07-21T17:30:09Z")

</div>

I am trying to use some ruby library code to sign some material with  
my private key,. and I am encountering an error.

I have a private key as part of my SSL credentials from [GoDaddy.com](http://GoDaddy.com).

I try key = OpenSSL::PKey::RSA.new(file.read) where key is the File  
holding my private key

I get OpenSSL::PKey::RSAError: Neither PUB key nor PRIV key:: header  
too long

the first line of the .key file is  
-----BEGIN RSA PRIVATE KEY-----

The key works fine at my service provide - along with my .crt, HTTPS  
works and IE and FF recognize the credentials.

Any idea what might be wrong ?

I do notice that if I print out the file in irb, there are \n  
characters at the end of each line . However, I don’t think that  
should be a problem.
