C# Class Argentini.Halide.H3Secure

The H3Secure class contains methods and properties for performing or evaluating security and authentication related operations. Make sure that you customize the halideEncryptionBaseKey and halideEncryptionInitVector values in the Halide.config file. This should be done for each site in which Halide is used. The halideEncryptionBaseKey attribute is an array of 24 8-bit numeric values (0-255), and the halideEncryptionInitVector attribute is an array of 18 8-bit numeric values (0-255). These values are used to seed and generate encrypted data when using any of the encryption methods within the H3Secure class.
Mostrar archivo Open project: argentini/Halide

Public Methods

Method Description
Base64PlusStringDecode ( string input ) : String

Base64+ decodes a string (valid in REST URL). Handles missing padding characters.

Base64PlusStringDecodeToBytes ( string input ) : byte[]

Base64+ decodes a string (valid in REST URL). Handles missing padding characters.

Base64PlusStringEncode ( byte input ) : String

Base64+ encodes a string (valid in REST URL).

Base64PlusStringEncode ( string input ) : String

Base64+ encodes a string (valid in REST URL).

Base64StringDecode ( string input ) : String

Base64 decodes a string.

Base64StringEncode ( string input ) : String

Base64 encodes a string.

CreateBaseKey ( String key ) : Byte[]

Converts a comma-separated string of 24 8-bit values and converts it into a Byte array.

CreateInitVector ( String key ) : Byte[]

Converts a comma-separated string of 18 8-bit values and converts it into a Byte array.

Decrypt ( String data ) : String

Triple DES 256 bit string decryption.

Decrypt ( String data, Byte key ) : String

Triple DES 256 bit string decryption.

Decrypt ( String data, Byte key, Byte ivec ) : String

Triple DES 256 bit string decryption.

Decrypt ( String data, String key, String ivec ) : String

Triple DES 256 bit string decryption.

DecryptInt32 ( String data ) : Int32?

Triple DES 256 bit integer decryption.

DecryptInt32 ( String data, Byte key ) : Int32?

Triple DES 256 bit integer decryption.

DecryptInt32 ( String data, Byte key, Byte ivec ) : Int32?

Triple DES 256 bit integer decryption.

DecryptInt32 ( String data, String key, String ivec ) : Int32?

Triple DES 256 bit integer decryption.

DecryptInt64 ( String data ) : Int64?

Triple DES 256 bit long integer (Int64) decryption.

DecryptInt64 ( String data, Byte key ) : Int64?

Triple DES 256 bit long integer (Int64) decryption.

DecryptInt64 ( String data, Byte key, Byte ivec ) : Int64?

Triple DES 256 bit long integer (Int64) decryption.

DecryptInt64 ( String data, String key, String ivec ) : Int64?

Triple DES 256 bit long integer (Int64) decryption.

Encrypt ( String data ) : String

Triple DES 256 bit string encryption.

Encrypt ( String data, Byte key ) : String

Triple DES 256 bit string encryption.

Encrypt ( String data, Byte key, Byte ivec ) : String

Triple DES 256 bit string encryption.

Encrypt ( String data, String key, String ivec ) : String

Triple DES 256 bit string encryption.

EncryptInt32 ( Int32 data ) : String

Triple DES 256 bit encryption of 32-bit integers.

EncryptInt32 ( Int32 data, Byte key ) : String

Triple DES 256 bit encryption of 32-bit integers.

EncryptInt32 ( Int32 data, Byte key, Byte ivec ) : String

Triple DES 256 bit encryption of 32-bit integers.

EncryptInt32 ( Int32 data, String key, String ivec ) : String

Triple DES 256 bit encryption of 32-bit integers.

EncryptInt64 ( System.Int64 data ) : String

Triple DES 256 bit encryption of 64-bit integers.

EncryptInt64 ( System.Int64 data, Byte key ) : String

Triple DES 256 bit encryption of 64-bit integers.

EncryptInt64 ( System.Int64 data, Byte key, Byte ivec ) : String

Triple DES 256 bit encryption of 64-bit integers.

EncryptInt64 ( System.Int64 data, String key, String ivec ) : String

Triple DES 256 bit encryption of 64-bit integers.

GenerateKey ( Int32 count ) : String

Generate a comma-separated string of 8-bit values for an encryption base key. The value is not guaranteed to be unique.

GetCurrentUser ( ) : String

Get the currently logged-in user name (with domain) from the client.

GetIdentity ( ) : String

Get the currently logged-in user name (with domain) for the running web page.

Impersonate ( ) : System.Boolean

Begins impersonation of an authenticated user on the server, so your page will have non-anonymous permissions (e.g. to write files, etc.).

Impersonate ( String domain, String userName, String password ) : System.Boolean

Begins impersonation of an authenticated user on the server, so your page will have non-anonymous permissions (e.g. to write files, etc.).

MD5String ( string input ) : String

MD5 encodes the passed string.

MD5VerifyString ( string input, string hash ) : System.Boolean

Verified a string against the passed MD5 hash.

TinyDecrypt ( string input ) : String

Decrypt a string encrypted with TinyEncrypt. Ideal for passing parameters on a URL. If you need strong encryption, do not use this method.

TinyEncrypt ( string input ) : String

Encrypt a string using a simple XOR and Base64 Encode. Ideal for passing parameters on a URL. If you need strong encryption, do not use this method.

UnImpersonate ( ) : void

Ends impersonation of an authenticated user on the server, reverting back to an anonymous, default, network service account.

Private Methods

Method Description
CloseHandle ( IntPtr handle ) : bool
EncryptDecrypt ( string textToEncrypt ) : String
H3Secure ( ) : System
LogonUser ( string principal, string authority, string password, LogonSessionType logonType, LogonProvider logonProvider, IntPtr &token ) : bool

Method Details

Base64PlusStringDecode() public static method

Base64+ decodes a string (valid in REST URL). Handles missing padding characters.
public static Base64PlusStringDecode ( string input ) : String
input string A base64+ encoded string.
return String

Base64PlusStringDecodeToBytes() public static method

Base64+ decodes a string (valid in REST URL). Handles missing padding characters.
public static Base64PlusStringDecodeToBytes ( string input ) : byte[]
input string A base64+ encoded string.
return byte[]

Base64PlusStringEncode() public static method

Base64+ encodes a string (valid in REST URL).
public static Base64PlusStringEncode ( byte input ) : String
input byte A byte array to encode.
return String

Base64PlusStringEncode() public static method

Base64+ encodes a string (valid in REST URL).
public static Base64PlusStringEncode ( string input ) : String
input string A string to encode.
return String

Base64StringDecode() public static method

Base64 decodes a string.
public static Base64StringDecode ( string input ) : String
input string A base64 encoded string.
return String

Base64StringEncode() public static method

Base64 encodes a string.
public static Base64StringEncode ( string input ) : String
input string A string to encode.
return String

CreateBaseKey() public static method

Converts a comma-separated string of 24 8-bit values and converts it into a Byte array.
public static CreateBaseKey ( String key ) : Byte[]
key String 32 8-bit values in a comma-separated list.
return Byte[]

CreateInitVector() public static method

Converts a comma-separated string of 18 8-bit values and converts it into a Byte array.
public static CreateInitVector ( String key ) : Byte[]
key String 18 8-bit values in a comma-separated list.
return Byte[]

Decrypt() public static method

Triple DES 256 bit string decryption.
public static Decrypt ( String data ) : String
data String String to decrypt.
return String

Decrypt() public static method

Triple DES 256 bit string decryption.
public static Decrypt ( String data, Byte key ) : String
data String String to decrypt.
key Byte 24 byte array key for decrypting the data. This must match the key used to encrypt the data.
return String

Decrypt() public static method

Triple DES 256 bit string decryption.
public static Decrypt ( String data, Byte key, Byte ivec ) : String
data String String to decrypt.
key Byte 24 byte array key for decrypting the data. This must match the key used to encrypt the data.
ivec Byte 18 byte array init vector for decrypting the data. This must match the init vector used to encrypt the data.
return String

Decrypt() public static method

Triple DES 256 bit string decryption.
public static Decrypt ( String data, String key, String ivec ) : String
data String String to decrypt.
key String 24 byte key string for decrypting the data. This must match the key used to encrypt the data.
ivec String 18 byte initialization vector string for the decryption routine. This must match the init vector used to encrypt the data.
return String

DecryptInt32() public static method

Triple DES 256 bit integer decryption.
public static DecryptInt32 ( String data ) : Int32?
data String String to decrypt.
return Int32?

DecryptInt32() public static method

Triple DES 256 bit integer decryption.
public static DecryptInt32 ( String data, Byte key ) : Int32?
data String String to decrypt.
key Byte 24 byte array key for decrypting the data. This must match the key used to encrypt the data.
return Int32?

DecryptInt32() public static method

Triple DES 256 bit integer decryption.
public static DecryptInt32 ( String data, Byte key, Byte ivec ) : Int32?
data String String to decrypt.
key Byte 24 byte array key for decrypting the data. This must match the key used to encrypt the data.
ivec Byte 18 byte array init vector for decrypting the data. This must match the init vector used to encrypt the data.
return Int32?

DecryptInt32() public static method

Triple DES 256 bit integer decryption.
public static DecryptInt32 ( String data, String key, String ivec ) : Int32?
data String String to decrypt.
key String 24 byte key string for decrypting the data. This must match the key used to encrypt the data.
ivec String 18 byte initialization vector string for the decryption routine. This must match the init vector used to encrypt the data.
return Int32?

DecryptInt64() public static method

Triple DES 256 bit long integer (Int64) decryption.
public static DecryptInt64 ( String data ) : Int64?
data String String to decrypt.
return Int64?

DecryptInt64() public static method

Triple DES 256 bit long integer (Int64) decryption.
public static DecryptInt64 ( String data, Byte key ) : Int64?
data String String to decrypt.
key Byte 24 byte array key for decrypting the data. This must match the key used to encrypt the data.
return Int64?

DecryptInt64() public static method

Triple DES 256 bit long integer (Int64) decryption.
public static DecryptInt64 ( String data, Byte key, Byte ivec ) : Int64?
data String String to decrypt.
key Byte 24 byte array key for decrypting the data. This must match the key used to encrypt the data.
ivec Byte 18 byte array init vector for decrypting the data. This must match the init vector used to encrypt the data.
return Int64?

DecryptInt64() public static method

Triple DES 256 bit long integer (Int64) decryption.
public static DecryptInt64 ( String data, String key, String ivec ) : Int64?
data String String to decrypt.
key String 24 byte key string for decrypting the data. This must match the key used to encrypt the data.
ivec String 18 byte initialization vector string for the decryption routine. This must match the init vector used to encrypt the data.
return Int64?

Encrypt() public static method

Triple DES 256 bit string encryption.
public static Encrypt ( String data ) : String
data String String to encrypt.
return String

Encrypt() public static method

Triple DES 256 bit string encryption.
public static Encrypt ( String data, Byte key ) : String
data String String to encrypt.
key Byte 24 byte array key for encrypting the data.
return String

Encrypt() public static method

Triple DES 256 bit string encryption.
public static Encrypt ( String data, Byte key, Byte ivec ) : String
data String String to encrypt.
key Byte 24 byte array key for encrypting the data.
ivec Byte 18 byte array initialization vector for the encryption routine.
return String

Encrypt() public static method

Triple DES 256 bit string encryption.
public static Encrypt ( String data, String key, String ivec ) : String
data String String to encrypt.
key String 32 byte key string for encrypting the data.
ivec String 16 byte initialization vector string for the encryption routine.
return String

EncryptInt32() public static method

Triple DES 256 bit encryption of 32-bit integers.
public static EncryptInt32 ( Int32 data ) : String
data System.Int32 Integer to encrypt.
return String

EncryptInt32() public static method

Triple DES 256 bit encryption of 32-bit integers.
public static EncryptInt32 ( Int32 data, Byte key ) : String
data System.Int32 Integer to encrypt.
key Byte 24 byte array key for encrypting the data.
return String

EncryptInt32() public static method

Triple DES 256 bit encryption of 32-bit integers.
public static EncryptInt32 ( Int32 data, Byte key, Byte ivec ) : String
data System.Int32 Integer to encrypt.
key Byte 24 byte array key for encrypting the data.
ivec Byte 18 byte array initialization vector for the encryption routine.
return String

EncryptInt32() public static method

Triple DES 256 bit encryption of 32-bit integers.
public static EncryptInt32 ( Int32 data, String key, String ivec ) : String
data System.Int32 Integer to encrypt.
key String 24 byte key string for encrypting the data.
ivec String 18 byte initialization vector string for the encryption routine.
return String

EncryptInt64() public static method

Triple DES 256 bit encryption of 64-bit integers.
public static EncryptInt64 ( System.Int64 data ) : String
data System.Int64 Long integer to encrypt.
return String

EncryptInt64() public static method

Triple DES 256 bit encryption of 64-bit integers.
public static EncryptInt64 ( System.Int64 data, Byte key ) : String
data System.Int64 Long integer to encrypt.
key Byte 24 byte array key for encrypting the data.
return String

EncryptInt64() public static method

Triple DES 256 bit encryption of 64-bit integers.
public static EncryptInt64 ( System.Int64 data, Byte key, Byte ivec ) : String
data System.Int64 Long integer to encrypt.
key Byte 24 byte array key for encrypting the data.
ivec Byte 18 byte array initialization vector for the encryption routine.
return String

EncryptInt64() public static method

Triple DES 256 bit encryption of 64-bit integers.
public static EncryptInt64 ( System.Int64 data, String key, String ivec ) : String
data System.Int64 Long integer to encrypt.
key String 24 byte key string for encrypting the data.
ivec String 18 byte initialization vector string for the encryption routine.
return String

GenerateKey() public static method

Generate a comma-separated string of 8-bit values for an encryption base key. The value is not guaranteed to be unique.
public static GenerateKey ( Int32 count ) : String
count System.Int32 Number of 8-bit numbers to generate
return String

GetCurrentUser() public static method

Get the currently logged-in user name (with domain) from the client.
public static GetCurrentUser ( ) : String
return String

GetIdentity() public static method

Get the currently logged-in user name (with domain) for the running web page.
public static GetIdentity ( ) : String
return String

Impersonate() public static method

Begins impersonation of an authenticated user on the server, so your page will have non-anonymous permissions (e.g. to write files, etc.).
public static Impersonate ( ) : System.Boolean
return System.Boolean

Impersonate() public static method

Begins impersonation of an authenticated user on the server, so your page will have non-anonymous permissions (e.g. to write files, etc.).
public static Impersonate ( String domain, String userName, String password ) : System.Boolean
domain String Domain name.
userName String User name.
password String password.
return System.Boolean

MD5String() public static method

MD5 encodes the passed string.
public static MD5String ( string input ) : String
input string The string to encode.
return String

MD5VerifyString() public static method

Verified a string against the passed MD5 hash.
public static MD5VerifyString ( string input, string hash ) : System.Boolean
input string The string to compare.
hash string The hash to compare against.
return System.Boolean

TinyDecrypt() public static method

Decrypt a string encrypted with TinyEncrypt. Ideal for passing parameters on a URL. If you need strong encryption, do not use this method.
public static TinyDecrypt ( string input ) : String
input string Encrypted string value to decrypt.
return String

TinyEncrypt() public static method

Encrypt a string using a simple XOR and Base64 Encode. Ideal for passing parameters on a URL. If you need strong encryption, do not use this method.
public static TinyEncrypt ( string input ) : String
input string String value to encrypt.
return String

UnImpersonate() public static method

Ends impersonation of an authenticated user on the server, reverting back to an anonymous, default, network service account.
public static UnImpersonate ( ) : void
return void