WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Conversion UDFs

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

udfBase64Encode and udfBase64Decode

 Keywords:  Encrypt base64 Encode Decode udfBase64Decode udfBase64Encode CAPICOM CAPICOM.Utilities

;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfBase64Encode (strSource)
objCCU = ObjectCreate ("CAPICOM.Utilities")
Return objCCU.Base64Encode(strSource)
;..........................................................................................................................................
; This UDF "udfBase64Encode" encodes a source string as base64 encoded string.
;..........................................................................................................................................
;   CAPICOM - Utilities.Base64Encode Method
;   [The Base64Encode method is available for use in the operating systems specified in the Requirements section.]
;
;   The Base64Encode method encodes a string as base64.
;
;   Syntax
;   VBScript
;   Function Base64Encode( _
;     ByVal SrcString _
;   )
;
;   Parameters
;   SrcString [in]
;   The string to encode as base64.
;
;   Return Value
;   The base64-encoded string.
;
;   Remarks
;   Base64 encoding is the scheme used to transmit binary data.
;   MBase64 processes data as 24-bit groups, mapping this data to four encoded characters.
;   Base64 encoding is sometimes referred to as 3-to-4 encoding.
;   Each 6 bits of the 24-bit group is used as an index into a mapping table (the base64 alphabet)
;   to obtain a character for the encoded data.
;   The encoded data has line lengths that are limited to 76 characters.
;
;   Requirements
;   Redistributable
;   CAPICOM 2.0 or later on Windows Server 2003, Windows XP, Windows 2000 Server with SP3 and later, and Windows 2000 Professional with SP3 and later
;   DLL
;   Capicom.dll
;
;   CAPICOM is a 32-bit only component that is available for use in the following operating systems:
;   Windows Server 2008, Windows Vista, Windows XP, and Windows 2000.
;   Instead, use the .NET Framework to implement security features.
;
;   See Also
;   Utilities [ http://msdn.microsoft.com/en-us/library/aa388176(VS.85).aspx ]
;..........................................................................................................................................
; (c)Detlev Dalitz.20100214.
;..........................................................................................................................................
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------


;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfBase64Decode (strEncoded)
objCCU = ObjectCreate ("CAPICOM.Utilities")
Return objCCU.Base64Decode(strEncoded)
;..........................................................................................................................................
; This UDF "udfBase64Decode" decodes an previously base64 encoded string.
;..........................................................................................................................................
;   CAPICOM -  Utilities.Base64Decode Method
;   [The Base64Decode method is available for use in the operating systems specified in the Requirements section.]
;
;   The Base64Decode method decodes a string from base64.
;
;   Syntax
;   VBScript
;   Function Base64Decode( _
;     ByVal EncodedString _
;   )
;
;   Parameters
;   EncodedString [in]
;   The base64-encoded string to decode.
;
;   Return Value
;   The decoded string.
;
;   Remarks
;   Base64 encoding is the scheme used to transmit binary data.
;   Base64 processes data as 24-bit groups, mapping this data to four encoded characters.
;   Base64 encoding is sometimes referred to as 3-to-4 encoding.
;   Each 6 bits of the 24-bit group is used as an index into a mapping table (the base64 alphabet)
;   to obtain a character for the encoded data.
;   The encoded data has line lengths that are limited to 76 characters.
;
;   Requirements
;   Redistributable
;   CAPICOM 2.0 or later on Windows Server 2003, Windows XP, Windows 2000 Server with SP3 and later,
;   and Windows 2000 Professional with SP3 and later
;   DLL
;   Capicom.dll
;
;   CAPICOM is a 32-bit only component that is available for use in the following operating systems:
;   Windows Server 2008, Windows Vista, Windows XP, and Windows 2000.
;   Instead, use the .NET Framework to implement security features.
;
;   See Also
;   Utilities [ http://msdn.microsoft.com/en-us/library/aa388176(VS.85).aspx ]
;..........................................................................................................................................
; (c)Detlev Dalitz.20100214.
;..........................................................................................................................................
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------


; Test.

strSource = "Encode64 Decode64 Test"

strEncoded = "" : udfBase64Encode (strSource)  ; "RQBuAGMAbwBkAGUANgA0ACAARABlAGMAbwBkAGUANgA0ACAAVABlAHMAdAA=@CRLF"

strDecoded = "" : udfBase64Decode (strEncoded) ; "Encode64 Decode64 Test"

Exit

Article ID:   W18347
Filename:   udfBase64Encode and udfBase64Decode.txt
File Created: 2010:05:10:12:17:10
Last Updated: 2010:05:10:12:17:10