Discussion:
Base64 encode and decode
amit paliwal
2011-01-20 19:21:54 UTC
Permalink
Hi,

As Curl provides many useful options to set with curl_easy_perform(), but
I don't see any option that takes whether we want to apply Base64 encoding
and decoding or not. There are API's available, which I can use from my
application code directly, API's are:

Curl_base64_encode()
Curl_base64_decode()

Do I need to use them explicitly, or there is some other way of using it
too.
--
Regards,
Amit
Dan Fandrich
2011-01-20 19:42:31 UTC
Permalink
Post by amit paliwal
As Curl provides many useful options to set with curl_easy_perform(), but
I don't see any option that takes whether we want to apply Base64 encoding and
decoding or not. There are API's available, which I can use from my application
Curl_base64_encode()
Curl_base64_decode()
Do I need to use them explicitly, or there is some other way of using it too.
libcurl base64-encodes control data in a few places automatically when
required (e.g. for Basic authentication), but it won't encode data. If your
application requires base64-encoded data, it will need to be so encoded in the
app. And those two functions are not actually part of the libcurl API, so
they aren't even available for use in apps, anyway.
Post by amit paliwal
Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
amit paliwal
2011-01-21 17:03:43 UTC
Permalink
Post by amit paliwal
Post by amit paliwal
As Curl provides many useful options to set with curl_easy_perform(), but
I don't see any option that takes whether we want to apply Base64
encoding and
Post by amit paliwal
decoding or not. There are API's available, which I can use from my
application
Post by amit paliwal
Curl_base64_encode()
Curl_base64_decode()
Do I need to use them explicitly, or there is some other way of using it
too.
libcurl base64-encodes control data in a few places automatically when
required (e.g. for Basic authentication), but it won't encode data. If your
application requires base64-encoded data, it will need to be so encoded in the
app. And those two functions are not actually part of the libcurl API, so
they aren't even available for use in apps, anyway.
So does it mean that if I use TLS and HTTPS I need not to apply it
separately and it will be done automatically??????
Post by amit paliwal
Post by amit paliwal
Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
--
Regards,
Amit
Daniel Stenberg
2011-01-21 19:16:57 UTC
Permalink
Post by amit paliwal
Post by Dan Fandrich
libcurl base64-encodes control data in a few places automatically when
required (e.g. for Basic authentication), but it won't encode data. If your
application requires base64-encoded data, it will need to be so encoded in
the app. And those two functions are not actually part of the libcurl API,
so they aren't even available for use in apps, anyway.
So does it mean that if I use TLS and HTTPS I need not to apply it
separately and it will be done automatically??????
It means that libcurl provides an API to do data transfers. You can use that
API as documented. libcurl offers transfers using a larger amount of different
protocols, and some of those protocols do sometimes require that data is sent
base64-encoded and then libcurl will do so.
--
/ daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
amit paliwal
2011-01-24 23:49:30 UTC
Permalink
Post by Dan Fandrich
libcurl base64-encodes control data in a few places automatically when
Post by amit paliwal
Post by Dan Fandrich
required (e.g. for Basic authentication), but it won't encode data. If your
application requires base64-encoded data, it will need to be so encoded in
the app. And those two functions are not actually part of the libcurl API,
so they aren't even available for use in apps, anyway.
So does it mean that if I use TLS and HTTPS I need not to apply it
Post by amit paliwal
separately and it will be done automatically??????
It means that libcurl provides an API to do data transfers. You can use
that API as documented. libcurl offers transfers using a larger amount of
different protocols, and some of those protocols do sometimes require that
data is sent base64-encoded and then libcurl will do so.
I tried using curl_base64.h, but when i installed the curl package, i did
not found this .h file in my /usr/local/include/curl directory where other
.h files like curl.h are present. Do i need to enable it with some
particular option.
Post by Dan Fandrich
--
/ daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
--
Regards,
Amit
Dan Fandrich
2011-01-25 00:25:25 UTC
Permalink
Post by Dan Fandrich
libcurl base64-encodes control data in a few places automatically
when required (e.g. for Basic authentication), but it won't encode
data. If your application requires base64-encoded data, it will
need to be so encoded in the app.  And those two functions are not
actually part of the libcurl API, so they aren't even available for
use in apps, anyway.
So does it mean that if I use TLS and HTTPS I need not to apply it
separately and it will be done automatically??????
It means that libcurl provides an API to do data transfers. You can use
that API as documented. libcurl offers transfers using a larger amount of
different protocols, and some of those protocols do sometimes require that
data is sent base64-encoded and then libcurl will do so.
I tried using curl_base64.h, but when i installed the curl package, i did not
found this .h file in my /usr/local/include/curl  directory where other .h
files like curl.h are present. Do i need to enable it with some particular
option.
I'm quoting the whole message, because the answer is contained in your own
e-mail, namely:

And those two functions are not actually part of the libcurl API, so
they aren't even available for use in apps, anyway.

That means you'll have to reimplement them yourself, or copy the source out of
libcurl. libcurl has a family of curlx_* functions that fall into this sort
of category of useful, but not really appropriate to have in the libcurl API,
but the base64 functions aren't included in these.
Post by Dan Fandrich
Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

Continue reading on narkive:
Loading...