Difference between revisions of "Base64"

From MgmtWiki
Jump to: navigation, search
(Problems)
(References)
 
(6 intermediate revisions by the same user not shown)
Line 4: Line 4:
 
Base64 coding was created to allow binary information to be passed over channels that cannot cope with the full range of characters represented by a binary stream.
 
Base64 coding was created to allow binary information to be passed over channels that cannot cope with the full range of characters represented by a binary stream.
 
==Problems==
 
==Problems==
* While Base64 works well for what it was designed to accomplish on [[Web Site]] communications over the World Wide Web, it cannot be used within a URL.
+
* While Base64 works well for what it was designed to accomplish on [[Web Site]] communications over the World Wide Web, it cannot be used within a URL. Defined in [https://tools.ietf.org/html/rfc4648#section-4 RFC 4648]
 
* Some uses of base64 require padding with "=" or "==" to ensure that the encode stream is always divisible by four.  Some uses prohibit such padding. Most uses don't care.
 
* Some uses of base64 require padding with "=" or "==" to ensure that the encode stream is always divisible by four.  Some uses prohibit such padding. Most uses don't care.
  
 
==Solution==
 
==Solution==
* Now there are two versions:
+
* Now there are two versions that occur in common web usage:
** Base64 uses the characters '+ and '/'
+
** Base64 uses the characters '+ and '/' typically with padding as defined in [https://tools.ietf.org/html/rfc4648#section-4 RFC 4648].
** Base64url uses the characters '-' and '_'
+
** Base64url uses the characters '-' and '_' and prohibits padding as defined in [https://tools.ietf.org/html/rfc7515#section-2 RFC 7515]. (This doc also discusses padding.)
 +
* While Base64 works well for what it was designed to accomplish on [[Web Site]] communications over the World Wide Web, it cannot be used within a URL.
 +
* Some uses of base64 require padding with "=" or "==" to ensure that the encode stream is always divisible by four.  Some uses prohibit such padding. Most uses don't care.
  
 
==References==
 
==References==
 
* [https://stackoverflow.com/questions/55389211/string-based-data-encoding-base64-vs-base64url String based data encoding: Base64 vs Base64url]
 
* [https://stackoverflow.com/questions/55389211/string-based-data-encoding-base64-vs-base64url String based data encoding: Base64 vs Base64url]
 +
* tl;dr [https://en.wikipedia.org/wiki/Base64 Wikipedia has far more to say] than the topic deserves and misses base64url completely (at least when this was written.)
 
[[Category:Glossary]]
 
[[Category:Glossary]]
 
[[Category:Standard]]
 
[[Category:Standard]]

Latest revision as of 15:57, 20 January 2020

Full Title

Base64 is a coding schema designed to convert binary data into ASCII encoded text.

Context

Base64 coding was created to allow binary information to be passed over channels that cannot cope with the full range of characters represented by a binary stream.

Problems

  • While Base64 works well for what it was designed to accomplish on Web Site communications over the World Wide Web, it cannot be used within a URL. Defined in RFC 4648
  • Some uses of base64 require padding with "=" or "==" to ensure that the encode stream is always divisible by four. Some uses prohibit such padding. Most uses don't care.

Solution

  • Now there are two versions that occur in common web usage:
    • Base64 uses the characters '+ and '/' typically with padding as defined in RFC 4648.
    • Base64url uses the characters '-' and '_' and prohibits padding as defined in RFC 7515. (This doc also discusses padding.)
  • While Base64 works well for what it was designed to accomplish on Web Site communications over the World Wide Web, it cannot be used within a URL.
  • Some uses of base64 require padding with "=" or "==" to ensure that the encode stream is always divisible by four. Some uses prohibit such padding. Most uses don't care.

References