On Thu, May 22, 2008 at 02:20:07PM +0200, karim Bendadda wrote:

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

The string is too long to fit on one line. The "openssl base64" decoder 
requires long strings to be split over multiple lines. As you can see, the
limit is 80 characters per-line:

    $ let i=15; while (( i < 25))
    do
        echo $i $(perl -e "printf qq{%s\n}, q{AAAA} x $i" |
                    openssl base64 -d | wc -c)
        let i=i+1
    done
    15 45
    16 48
    17 51
    18 54
    19 57
    20 0
    21 0
    22 0
    23 0
    24 0

Also each line MUST end with "\n" or "\r\n", incomplete last lines don't
work:

    $ let i=15; while (( i < 25))
    do
        echo $i $(perl -e "printf qq{%s}, q{AAAA} x $i" |
                    openssl base64 -d | wc -c)
        let i=i+1
    done
    15 0
    16 0
    17 0
    18 0
    19 0
    20 0
    21 0
    22 0
    23 0
    24 0

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

Reply via email to