Re: PEM_read PrivateKey gives illegal seek - Openssl

This is a discussion on Re: PEM_read PrivateKey gives illegal seek - Openssl ; > Hi, > > You should you generate an X509 certificate and then try to read the private key with PEM_read_PrivateKey. What does the key that you are trying to load look like? Could it be that you are reading ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Re: PEM_read PrivateKey gives illegal seek

  1. Re: PEM_read PrivateKey gives illegal seek

    > Hi,
    >
    > You should you generate an X509 certificate and then try to read the

    private key with PEM_read_PrivateKey. What does the key that you are
    trying to load look like? Could it be that you are reading in the
    certificate in place of the key?
    >
    > Also, I don't know much about perror, butOpenSSL has its own error

    function to help you determine if OpenSSL is encountering any errors.
    Consider using ERR_print_errors_fp to determine if OpenSSL is
    > encountering any errors (http://www.openssl.org/docs/crypto/
    > ERR_print_errors.html#).


    Hi,

    the output of ERR_print_errors prints a message I dont understand:
    18171:error:0906B072:lib(9):func(107):reason(114)em_lib.c:481:

    My private key is for testing my routine only though here it is:

    -----BEGIN RSA PRIVATE KEY-----
    Proc-Type: 4,ENCRYPTED
    DEK-Info: DES-EDE3-CBC,731DA7CE59042744

    +IyLelmxFc08egtoHkIjRXyCYAYEYJJumHuotIjy5AWEhE8vtu dTRfzbWrlALmDt
    jODDIo7AGPC6PE0DcBHruCno6/Rkvngokqr+2zjne1sllLqo/41SUaSEcKKByvt0
    6gJTFCj+zbPLj+aRUb3C6ktXDyBRq1swYsfDgf8ooH4/eqZ3Fm1iHMbglZJPpkuV
    lC8Uip/7LUze6iAlJspQuA91d/H53oIbjz30KnYfBPWTALrEgqAU0kV/TYzhVowJ
    YA47ybuEtzOk+mq6g8Z791lKFk/LlNJ5hvN4sSJyVA4hv2gLYikrJwKcAmVUXVnR
    LJoz3CWDQapuA+3VGF76wOEULMUQ5NStGEEldWzF+D8vK/svRl996UMXCYdME/tH
    FyBXzGntkh9N7s9KSdP5Nb6Hpf/si9ivpAuMkwCfeoep/hN/2WEe2wuVTEbXy0Xm
    BCIWp6/6MMrZx3siMaifSYSaZGm68U/sMa118FTKTcdkSdPel4oW4w7zcowIfaYy
    dK/DB8p3Bk7nAIgTKSWbs3w8fdLNtmj88dt9RdZ+wPCZ+y510UEns sfMKNGAVpGU
    XfMR42dvAwqPgrxQl9DMbZk36Qnrx7/vaZ+3cUz2eApASdVJyV1HJEh7fbYt25/P
    05TZiS649/5+GDpSF5bZwZO/u4ydSAI5EoreN9KmtMgDsnavnfjio55/WuWuEWH1
    7xrCR88of0lHJyvb2fWDnHbxCwOLcgurmcMH/qcQFFk2VsXbmWWSTg2n+Pd2ADk1
    rJAazSG24ax1CJZ+sIWsJEm8O0Cj2GyleqFKzMikcpoRbNkelM TT0Q==
    -----END RSA PRIVATE KEY-----

    this is a private key or am I wrong ?

    Ciao
    Matthias



    __________________________________________________ ____________________
    OpenSSL Project http://www.openssl.org
    User Support Mailing List openssl-users@openssl.org
    Automated List Manager majordomo@openssl.org


  2. RE: PEM_read PrivateKey gives illegal seek


    > > Hi,
    > >
    > > You should you generate an X509 certificate and then try to read the

    > private key with PEM_read_PrivateKey. What does the key that you are
    > trying to load look like? Could it be that you are reading in the
    > certificate in place of the key?
    > >
    > > Also, I don't know much about perror, butOpenSSL has its own error

    > function to help you determine if OpenSSL is encountering any errors.
    > Consider using ERR_print_errors_fp to determine if OpenSSL is
    > > encountering any errors (http://www.openssl.org/docs/crypto/
    > > ERR_print_errors.html#).

    >
    > Hi,
    >
    > the output of ERR_print_errors prints a message I dont understand:
    > 18171:error:0906B072:lib(9):func(107):reason(114)em_lib.c:481:


    "openssl errstr 0906B072" Gives:
    error:0906B072:PEM routines:PEM_get_EVP_CIPHER_INFO:unsupported encryption

    DS


    __________________________________________________ ____________________
    OpenSSL Project http://www.openssl.org
    User Support Mailing List openssl-users@openssl.org
    Automated List Manager majordomo@openssl.org


  3. Re: PEM_read PrivateKey gives illegal seek

    Hi,

    ok, sorry for not understanding what happens. The call
    OpenSSL_add_all_algorithms() was missing.

    After adding it everything seems to work perfect.

    Shouldn't this be mentioned on the man page of the PEM functions ?

    Ciao
    Matthias


    __________________________________________________ ____________________
    OpenSSL Project http://www.openssl.org
    User Support Mailing List openssl-users@openssl.org
    Automated List Manager majordomo@openssl.org


  4. Re: PEM_read PrivateKey gives illegal seek

    Matthias Barmeier wrote:
    > Hi,
    >
    > ok, sorry for not understanding what happens. The call
    > OpenSSL_add_all_algorithms() was missing.
    >
    > After adding it everything seems to work perfect.
    >
    > Shouldn't this be mentioned on the man page of the PEM functions ?


    It is not PEM specific - it applies to anything trying to use an algorithm which
    hasn't been registered.


    The FAQ does indeed contain information about this:

    http://www.openssl.org/support/faq.html#PROG8

    8. Why do I get errors about unknown algorithms?

    The cause is forgetting to load OpenSSL's table of algorithms with
    OpenSSL_add_all_algorithms(). See the manual page for more information. This can
    cause several problems such as being unable to read in an encrypted PEM file,
    unable to decrypt a PKCS#12 file or signature failure when verifying certificates.

    Tim.

    -----BEGIN PGP SIGNATURE-----
    Version: PGP Desktop 9.8.3 (Build 4028)

    iQEVAwUBSKIrRNKL2dwk7eD9AQjMiAgAkPydP6PQ0a7RySAowm d+mDtbhxKCZkQM
    zBgkd5LmdOE5vRmFSRLHXWo0TN5IjY7jGbHxpCLEbnw8WByekU OtwdYorrQO9CVt
    rnCWIAtDgiM8BzvLl5Jeoy9ZeijKuaS7Bg1SJUQ1CtpG0tMdhv VRlHs9YvMkIV2z
    PJfq3TWnA3qahO35Gp9J5BuflnXDlVca7PmdOl70qUDea6cVl5 5G5GKusURntbHI
    jP0weGrfOle6h2FzW2dB4JoAuDlOfASMZ2hol06MzzNTnB2WeR likk8tsP4CQRUl
    c30Sfi3z5wqLlXePaL28qXsGWkn88/5Kc1VTcxvu4XCY9rcnXf4CFQ==
    =+2Tv
    -----END PGP SIGNATURE-----


  5. Re: PEM_read PrivateKey gives illegal seek

    Hi Tim,

    after understanding what happens I found and understand FAQ. But if it is
    part of the FAQ why not putting a hint on the relevant man pages, Maybe
    after doing this this item is no FAQ any more .

    Ciao
    Matthias

    > Matthias Barmeier wrote:
    >> Hi,
    >>
    >> ok, sorry for not understanding what happens. The call
    >> OpenSSL_add_all_algorithms() was missing.
    >>
    >> After adding it everything seems to work perfect.
    >>
    >> Shouldn't this be mentioned on the man page of the PEM functions ?

    >
    > It is not PEM specific - it applies to anything trying to use an algorithm
    > which
    > hasn't been registered.
    >
    >
    > The FAQ does indeed contain information about this:
    >
    > http://www.openssl.org/support/faq.html#PROG8
    >
    > 8. Why do I get errors about unknown algorithms?
    >
    > The cause is forgetting to load OpenSSL's table of algorithms with
    > OpenSSL_add_all_algorithms(). See the manual page for more information.
    > This can
    > cause several problems such as being unable to read in an encrypted PEM
    > file,
    > unable to decrypt a PKCS#12 file or signature failure when verifying
    > certificates.
    >
    > Tim.
    >



    __________________________________________________ ____________________
    OpenSSL Project http://www.openssl.org
    User Support Mailing List openssl-users@openssl.org
    Automated List Manager majordomo@openssl.org


+ Reply to Thread