0

I have this annoying M2Crypto error:

In [126]: M2Crypto.EVP.load_key('private-key-2048.pem', 'r')
---------------------------------------------------------------------------
BIOError                                  Traceback (most recent call last)
/<DJANGOPATH>/django/core/management/commands/shell.pyc in <module>()
----> 1 M2Crypto.EVP.load_key('private-key-2048.pem', 'r')

/var/www/.../lib/python2.6/site-packages/M2Crypto-0.21.1-py2.6-linux-x86_64.egg/M2Crypto/EVP.py in load_key(file, callback)
    364     bio = m2.bio_new_file(file, 'r')
    365     if bio is None:
--> 366         raise BIO.BIOError(Err.get_error())
    367     cptr = m2.pkey_read_pem(bio, callback)
    368     m2.bio_free(bio)

BIOError: 47625728188304:error:0200100E:system library:fopen:Bad address:bss_file.c:122:fopen('','r')
47625728188304:error:2006D002:BIO routines:BIO_new_file:system lib:bss_file.c:127:

Update:

-rw-rw-r-- 1 user group 1675 Feb 13 08:27 private-key-2048.pem
halfer
  • 19,824
  • 17
  • 99
  • 186
patroqueeet
  • 764
  • 1
  • 8
  • 19

1 Answers1

0
    364     bio = m2.bio_new_file(file, 'r')
    365     if bio is None:
--> 366         raise BIO.BIOError(Err.get_error())

bio_new_file method returns None if passed filename/object cann't open.

I'd check if 'private-key-2048.pem' really does exist in path where it's expected and also check its read permissions.

David Unric
  • 7,421
  • 1
  • 37
  • 65
  • Is the 'private-key-2048.pem' in the path where the django shell is looking for ? Can you specify the full path like `/home/user/certs/private-key-2048.pem` and pass it to the module where the loading is made ? – David Unric Feb 13 '13 at 18:27