Class Encryption
- Namespace
- ArcanaDevelopment.adTempus.Shared
- Assembly
- ArcanaDevelopment.adTempus.Shared.dll
public static class Encryption
- Inheritance
-
object
Encryption
Fields
KeySize
public const int KeySize = 24
Field Value
- int
SHA256OID
The OID to use when signing using SHA256 algorithm.
public const string SHA256OID = "2.16.840.1.101.3.4.2.1"
Field Value
- string
Properties
RandomNumberGenerator
public static RandomNumberGenerator RandomNumberGenerator { get; }
Property Value
- RandomNumberGenerator
Methods
CreateSessionKey()
Creates a block of random bytes that can be used as a session key.
public static byte[] CreateSessionKey()
Returns
- byte[]
DecryptString(string, byte[])
public static string DecryptString(string source, byte[] password)
Parameters
| Name | Type | Description |
source |
string |
|
password |
byte[] |
|
Returns
- string
DecryptStringToSecureString(string, byte[])
public static SecureString DecryptStringToSecureString(string source, byte[] password)
Parameters
| Name | Type | Description |
source |
string |
|
password |
byte[] |
|
Returns
- SecureString
DecryptStringToString(string, byte[])
public static string DecryptStringToString(string source, byte[] password)
Parameters
| Name | Type | Description |
source |
string |
|
password |
byte[] |
|
Returns
- string
DecryptV3Data(byte[], byte[])
Decrypt data encrypted using Blowfish in version 3
public static string DecryptV3Data(byte[] source, byte[] key)
Parameters
| Name | Type | Description |
source |
byte[] |
|
key |
byte[] |
|
Returns
- string
DecryptV3Data(string, byte[])
public static string DecryptV3Data(string source, byte[] key)
Parameters
| Name | Type | Description |
source |
string |
|
key |
byte[] |
|
Returns
- string
EncryptDataWithPublicKey(byte[], string)
Encrypts data using the specified RSA public key.
public static byte[] EncryptDataWithPublicKey(byte[] source, string keyXML)
Parameters
| Name | Type | Description |
source |
byte[] |
|
keyXML |
string |
|
Returns
- byte[]
EncryptString(SecureString, byte[])
public static string EncryptString(SecureString source, byte[] password)
Parameters
| Name | Type | Description |
source |
SecureString |
|
password |
byte[] |
|
Returns
- string
EncryptString(string, byte[])
public static string EncryptString(string source, byte[] password)
Parameters
| Name | Type | Description |
source |
string |
|
password |
byte[] |
|
Returns
- string
The encrypted value plus the salt value used in encryption.
EncryptString(string, byte[], byte[])
public static string EncryptString(string source, byte[] password, byte[] ivBytes)
Parameters
| Name | Type | Description |
source |
string |
|
password |
byte[] |
|
ivBytes |
byte[] |
|
Returns
- string
GetRandomBytes(int)
Creates a random encryption key suitable for use by the encryption/decryption methods in this class.
public static byte[] GetRandomBytes(int length)
Parameters
| Name | Type | Description |
length |
int |
|
Returns
- byte[]
ReEncryptStringToString(string, byte[], byte[])
public static string ReEncryptStringToString(string source, byte[] sourcePW, byte[] targetPW)
Parameters
| Name | Type | Description |
source |
string |
|
sourcePW |
byte[] |
|
targetPW |
byte[] |
|
Returns
- string