ArticleDirectory
This an implementation of base64 as described in rfc4648 (the base16, base32, and base64 data encodings) for the Lotus Notes environment.
Base64 is an algorithm to encode binary data into a ASCII text representation. common applications are
- Passing credentials to Web servers: HTTP Authentication: basic and digest access authentication.
- Transferring binary data in Email: For this purpose, the encoding can be run in mime-mode to produce line breaks.
- Transferring or storing binary data in other formats, like XML.
This library makes use of notesstreams and notesmimeentity that came with Notes 6.
Usage
- Save and unzip the code to a text file (libbase64.lss)
- Use Domino designer to create a new empty Lotus script library 'libbase64 ′
- Import libbase64.lss and save the Lib
- Now you can include the Library (
Use "libbase64"
) And use it:
Dim b64 as new cbase64 ()
Call b64.encode (..)
Samples
Encode a string to base64
Dim b64 as new cbase64 ()
Print b64.encodestring ("foobar ")
Encode a binary file to a base64 encoded file
Dim b64 as new cbase64 ()
Call b64.encodefiletofile (fspecinput, fspecoutput)
The result file will have line breaks at column 76. If this is not desired, than it can be suppressed. This will be a bit slower however:
Dim b64 as new cbase64 () b64.bmimemodeencoding = falsecall b64.encodefiletofile (fspecinput, fspecoutput)
Decode a base64 encoded file to a (probably binary) File
Dim b64 as new cbase64 ()
Call b64.decodefiletofile (fspecinput, fspecoutput)