Share via


CryptographicBuffer.DecodeFromBase64String(String) Method

Definition

Decodes a string that has been base64 encoded.

public:
 static IBuffer ^ DecodeFromBase64String(Platform::String ^ value);
 static IBuffer DecodeFromBase64String(winrt::hstring const& value);
public static IBuffer DecodeFromBase64String(string value);
function decodeFromBase64String(value)
Public Shared Function DecodeFromBase64String (value As String) As IBuffer

Parameters

value
String

Platform::String

winrt::hstring

Base64 encoded input string.

Returns

Output buffer that contains the decoded string.

Examples

public void EncodeDecodeBase64()
{
    // Define a Base64 encoded string.
    String strBase64 = "uiwyeroiugfyqcajkds897945234==";

    // Decoded the string from Base64 to binary.
    IBuffer buffer = CryptographicBuffer.DecodeFromBase64String(strBase64);

    // Encode the buffer back into a Base64 string.
    String strBase64New = CryptographicBuffer.EncodeToBase64String(buffer);
}

Remarks

Base64 processes data as 24-bit groups, mapping each group to four encoded 8-bit 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.

Applies to