You have to write a loop
1) extract the 64 first byte from the coded string and copy the to a working buffer
   2) convert the working buffer to aat most  48 bytes result buffer
   3) copy the working buffer to the the result
   4) continue with the next 64 byte s of the input string
karim Bendadda a écrit :
Hi Dominique,


First I'd like to thank you for your quick answer. You're right, it works well when spliting. I'd like now to do it using the openssl API (I found the function above on the web). This function works well for input at most 64 bytes .May I have to do a manual split where input is at least 64 bytes long? Is there any methods (an Openssl function for example) to do it automatically???.

Thank you for your efforts.

/char *unbase64(unsigned char *input, int length)
{
  BIO *b64, *bmem;

  char *buffer = (char *)malloc(length);
  memset(buffer, 0, length);

  b64 = BIO_new(BIO_f_base64());
  bmem = BIO_new_mem_buf(input, length);
  bmem = BIO_push(b64, bmem);

  BIO_read(bmem, buffer, length);

  BIO_free_all(bmem);

  return buffer;
}
/
---------------------------------------------------------------------------------------------------------------------------------------
On Thu, May 22, 2008 at 3:57 PM, Dominique Lohez <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    Hello karim
    The line must be at most 64 octets long
    using the file  essai.pem where the unique has been splited in three
    the command

    openssl enc -base64 -d -in essai.pem
    works.

    but be carefull most of the character    are not printables

    karim Bendadda a écrit :

        Hi All,

          I'm trying to decode a Base64 encoded string. Using the
openssl decoding command:/ echo
        
"nnnKZdKOQMmVpLEOBqNU3L07ELMSoQxW0z7SvgZBmwXpjvMYPqnSMaWy9vu6NFUHGc40nhLbaFe8vI159nZHHdMOssHyfI6kzXljRolfrSX6bNjcMvfy7k5J+2xo451u="
        | openssl enc -base64 -d

        /I got no result! nothing!!!  I tried to decode this string on
        an online base64 decoder
        http://webnet77.com/cgi-bin/helpers/base-64.pl  and it's ok!!
        I have the correct string
        ( wich is an encrypted string). What's wrong with openssl
        command???

        Thank you for help.

-- Karim



-- Dr Dominique LOHEZ
    ISEN
    41, Bd Vauban
    F59046 LILLE
    France

    Phone : +33 (0)3 20 30 40 71
    Email: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>

    ______________________________________________________________________
    OpenSSL Project                                 http://www.openssl.org
User Support Mailing List openssl-users@openssl.org <mailto:openssl-users@openssl.org> Automated List Manager [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>




--
Karim


--
Dr Dominique LOHEZ
ISEN
41, Bd Vauban
F59046 LILLE
France

Phone : +33 (0)3 20 30 40 71
Email: [EMAIL PROTECTED]

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to