C# Class Net.Pkcs11Interop.Common.ConvertUtils

Utility class that helps with data type conversions.
显示文件 Open project: Pkcs11Interop/Pkcs11Interop

Public Methods

Method Description
Base64StringToBytes ( string value ) : byte[]

Converts Base64 encoded string to byte array

BoolToBytes ( bool value ) : byte[]

Converts bool to byte array

BytesToBase64String ( byte value ) : string

Converts byte array to Base64 encoded string

BytesToBool ( byte value ) : bool

Converts byte array to bool

BytesToHexString ( byte value ) : string

Converts byte array to hex encoded string

BytesToUInt ( byte value ) : uint

Converts byte array to uint

BytesToULong ( byte value ) : ulong

Converts byte array to ulong

BytesToUtf8String ( byte value ) : string

Converts byte array (not null terminated) to UTF-8 string

BytesToUtf8String ( byte value, bool trimEnd ) : string

Converts byte array to UTF-8 string (not null terminated)

BytesToUtf8String ( byte value, int index, int count ) : string

Converts specified range of byte array to UTF-8 string (not null terminated)

HexStringToBytes ( string value ) : byte[]

Converts hex encoded string to byte array

UIntToBytes ( uint value ) : byte[]

Converts uint to byte array

ULongToBytes ( ulong value ) : byte[]

Converts ulong to byte array

UtcTimeStringToDateTime ( string utcTime ) : DateTime?

Converts string with UTC time to DateTime

Utf8StringToBytes ( string value ) : byte[]

Converts UTF-8 string to byte array (not null terminated)

Utf8StringToBytes ( string value, int outputLength, byte paddingByte ) : byte[]

Converts UTF-8 string to byte array padded or trimmed to specified length

Method Details

Base64StringToBytes() public static method

Converts Base64 encoded string to byte array
public static Base64StringToBytes ( string value ) : byte[]
value string String that should be converted
return byte[]

BoolToBytes() public static method

Converts bool to byte array
public static BoolToBytes ( bool value ) : byte[]
value bool Bool that should be converted
return byte[]

BytesToBase64String() public static method

Converts byte array to Base64 encoded string
public static BytesToBase64String ( byte value ) : string
value byte Byte array that should be converted
return string

BytesToBool() public static method

Converts byte array to bool
public static BytesToBool ( byte value ) : bool
value byte Byte array that should be converted
return bool

BytesToHexString() public static method

Converts byte array to hex encoded string
public static BytesToHexString ( byte value ) : string
value byte Byte array that should be converted
return string

BytesToUInt() public static method

Converts byte array to uint
public static BytesToUInt ( byte value ) : uint
value byte Byte array that should be converted
return uint

BytesToULong() public static method

Converts byte array to ulong
public static BytesToULong ( byte value ) : ulong
value byte Byte array that should be converted
return ulong

BytesToUtf8String() public static method

Converts byte array (not null terminated) to UTF-8 string
public static BytesToUtf8String ( byte value ) : string
value byte Byte array that should be converted
return string

BytesToUtf8String() public static method

Converts byte array to UTF-8 string (not null terminated)
public static BytesToUtf8String ( byte value, bool trimEnd ) : string
value byte Byte array that should be converted
trimEnd bool Flag indicating whether white space characters should be removed from the end of resulting string
return string

BytesToUtf8String() public static method

Converts specified range of byte array to UTF-8 string (not null terminated)
public static BytesToUtf8String ( byte value, int index, int count ) : string
value byte Byte array that should be processed
index int Starting index of bytes to decode
count int Number of bytes to decode
return string

HexStringToBytes() public static method

Converts hex encoded string to byte array
public static HexStringToBytes ( string value ) : byte[]
value string String that should be converted
return byte[]

UIntToBytes() public static method

Converts uint to byte array
public static UIntToBytes ( uint value ) : byte[]
value uint Uint that should be converted
return byte[]

ULongToBytes() public static method

Converts ulong to byte array
public static ULongToBytes ( ulong value ) : byte[]
value ulong Uint that should be converted
return byte[]

UtcTimeStringToDateTime() public static method

Converts string with UTC time to DateTime
public static UtcTimeStringToDateTime ( string utcTime ) : DateTime?
utcTime string UTC time that should be converted (formatted as string of length 16 represented in the format YYYYMMDDhhmmssxx).
return DateTime?

Utf8StringToBytes() public static method

Converts UTF-8 string to byte array (not null terminated)
public static Utf8StringToBytes ( string value ) : byte[]
value string String that should be converted
return byte[]

Utf8StringToBytes() public static method

Converts UTF-8 string to byte array padded or trimmed to specified length
public static Utf8StringToBytes ( string value, int outputLength, byte paddingByte ) : byte[]
value string String that should be converted
outputLength int Expected length of byte array
paddingByte byte Padding byte that will be used for padding to expected length
return byte[]