Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class Microsoft.​IdentityModel.​Tokens.​Base64UrlEncoder
Assembly: Microsoft.IdentityModel.Tokens
Inheritance: object → Base64UrlEncoder
Encodes and Decodes strings as base64url encoding.
Methods
public static
string
Encode​(string arg)
Performs base64url encoding, which differs from regular base64 encoding as follows:
* Padding is skipped so the pad character '=' doesn't have to be percent encoded.
* The 62nd and 63rd regular base64 encoding characters ('+' and '/') are replaced with ('-' and '_').
This makes the encoding alphabet URL safe.
Returns The base64url encoding of the UTF8 bytes.
arg
The string to encode.
public static
string
Encode​(byte[] inArray)
Converts a subset of an array of 8-bit unsigned integers to its equivalent string representation encoded with base64url digits.
Returns The base64url encoded string representation of the elements in inArray.
inArray
An array of 8-bit unsigned integers.
public static
string
Encode​(byte[] inArray,
int offset,
int length)
Converts a subset of an array of 8-bit unsigned integers to its equivalent string representation encoded with base64url digits.
Parameters specify the subset as an offset in the input array and the number of elements in the array to convert.
Returns The base64url encoded string representation of length elements of inArray, starting at position offset.
inArray
An array of 8-bit unsigned integers.
offset
An offset in inArray.
length
The number of elements of inArray to convert.
public static
int
Encode​(System.​ReadOnlySpan<​byte> inArray,
System.​Span<​char> output)
Populates a <see cref="T:System.Span`1" /> with the base64url encoded representation of a <see cref="T:System.ReadOnlySpan`1" /> of bytes.
Returns The number of characters written to the output span.
inArray
A read-only span of bytes to encode.
output
The span of characters to write the encoded output.
public static
byte[]
DecodeBytes​(string str)
Converts the specified base64url encoded string to UTF-8 bytes.
Returns The UTF-8 bytes.
str
The base64url encoded string.
public static
string
Decode​(string arg)
Decodes the specified base64url encoded string to UTF-8.
Returns The UTF-8 decoded string.
arg
The base64url encoded string to decode.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object