Pkcs11Interop  4.0.0
Static Public Member Functions | List of all members
Net.Pkcs11Interop.Common.ConvertUtils Class Reference

Utility class that helps with data type conversions. More...

Static Public Member Functions

static byte[] UIntToBytes (uint value)
 Converts uint to byte array More...
 
static uint BytesToUInt (byte[] value)
 Converts byte array to uint More...
 
static byte[] ULongToBytes (ulong value)
 Converts ulong to byte array More...
 
static ulong BytesToULong (byte[] value)
 Converts byte array to ulong More...
 
static byte[] BoolToBytes (bool value)
 Converts bool to byte array More...
 
static bool BytesToBool (byte[] value)
 Converts byte array to bool More...
 
static byte[] Utf8StringToBytes (string value)
 Converts UTF-8 string to byte array (not null terminated) More...
 
static byte[] Utf8StringToBytes (string value, int outputLength, byte paddingByte)
 Converts UTF-8 string to byte array padded or trimmed to specified length More...
 
static string BytesToUtf8String (byte[] value)
 Converts byte array (not null terminated) to UTF-8 string More...
 
static string BytesToUtf8String (byte[] value, bool trimEnd)
 Converts byte array to UTF-8 string (not null terminated) More...
 
static string BytesToUtf8String (byte[] value, int index, int count)
 Converts specified range of byte array to UTF-8 string (not null terminated) More...
 
static DateTime UtcTimeStringToDateTime (string utcTime)
 Converts string with UTC time to DateTime More...
 
static string BytesToHexString (byte[] value)
 Converts byte array to hex encoded string More...
 
static byte[] HexStringToBytes (string value)
 Converts hex encoded string to byte array More...
 
static string BytesToBase64String (byte[] value)
 Converts byte array to Base64 encoded string More...
 
static byte[] Base64StringToBytes (string value)
 Converts Base64 encoded string to byte array More...
 

Detailed Description

Utility class that helps with data type conversions.

Member Function Documentation

static byte [] Net.Pkcs11Interop.Common.ConvertUtils.Base64StringToBytes ( string  value)
static

Converts Base64 encoded string to byte array

Parameters
valueString that should be converted
Returns
Byte array decoded from string
static byte [] Net.Pkcs11Interop.Common.ConvertUtils.BoolToBytes ( bool  value)
static

Converts bool to byte array

Parameters
valueBool that should be converted
Returns
Byte array with bool value
static string Net.Pkcs11Interop.Common.ConvertUtils.BytesToBase64String ( byte[]  value)
static

Converts byte array to Base64 encoded string

Parameters
valueByte array that should be converted
Returns
String with Base64 encoded value from byte array
static bool Net.Pkcs11Interop.Common.ConvertUtils.BytesToBool ( byte[]  value)
static

Converts byte array to bool

Parameters
valueByte array that should be converted
Returns
Bool with value from byte array
static string Net.Pkcs11Interop.Common.ConvertUtils.BytesToHexString ( byte[]  value)
static

Converts byte array to hex encoded string

Parameters
valueByte array that should be converted
Returns
String with hex encoded value from byte array
static uint Net.Pkcs11Interop.Common.ConvertUtils.BytesToUInt ( byte[]  value)
static

Converts byte array to uint

Parameters
valueByte array that should be converted
Returns
Uint with value from byte array
static ulong Net.Pkcs11Interop.Common.ConvertUtils.BytesToULong ( byte[]  value)
static

Converts byte array to ulong

Parameters
valueByte array that should be converted
Returns
Uint with value from byte array
static string Net.Pkcs11Interop.Common.ConvertUtils.BytesToUtf8String ( byte[]  value)
static

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

Parameters
valueByte array that should be converted
Returns
String with value from byte array
static string Net.Pkcs11Interop.Common.ConvertUtils.BytesToUtf8String ( byte[]  value,
bool  trimEnd 
)
static

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

Parameters
valueByte array that should be converted
trimEndFlag indicating whether white space characters should be removed from the end of resulting string
Returns
String with value from byte array
static string Net.Pkcs11Interop.Common.ConvertUtils.BytesToUtf8String ( byte[]  value,
int  index,
int  count 
)
static

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

Parameters
valueByte array that should be processed
indexStarting index of bytes to decode
countNumber of bytes to decode
Returns
String with value from byte array
static byte [] Net.Pkcs11Interop.Common.ConvertUtils.HexStringToBytes ( string  value)
static

Converts hex encoded string to byte array

Parameters
valueString that should be converted
Returns
Byte array decoded from string
static byte [] Net.Pkcs11Interop.Common.ConvertUtils.UIntToBytes ( uint  value)
static

Converts uint to byte array

Parameters
valueUint that should be converted
Returns
Byte array with uint value
static byte [] Net.Pkcs11Interop.Common.ConvertUtils.ULongToBytes ( ulong  value)
static

Converts ulong to byte array

Parameters
valueUint that should be converted
Returns
Byte array with ulong value
static DateTime Net.Pkcs11Interop.Common.ConvertUtils.UtcTimeStringToDateTime ( string  utcTime)
static

Converts string with UTC time to DateTime

Parameters
utcTimeUTC time that should be converted (formatted as string of length 16 represented in the format YYYYMMDDhhmmssxx).
Returns
DateTime if successful, null otherwise.
static byte [] Net.Pkcs11Interop.Common.ConvertUtils.Utf8StringToBytes ( string  value)
static

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

Parameters
valueString that should be converted
Returns
Byte array with string value
static byte [] Net.Pkcs11Interop.Common.ConvertUtils.Utf8StringToBytes ( string  value,
int  outputLength,
byte  paddingByte 
)
static

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

Parameters
valueString that should be converted
outputLengthExpected length of byte array
paddingBytePadding byte that will be used for padding to expected length
Returns
Byte array with string value padded or trimmed to specified length

The documentation for this class was generated from the following file: