C# Class Keen.Core.ScopedKey

ScopedKey provides encryption and decryption functions which can be used to create and read scoped keys, such as the API Read and Write keys.
Mostrar archivo Open project: keenlabs/keen-sdk-net

Public Methods

Method Description
Decrypt ( string apiKey, string scopedKey ) : string

Decrypt an existing scoped key.

Encrypt ( string apiKey, object secOptions, string IV = "" ) : string

Encrypt an object containing security options to create a scoped key.

EncryptString ( string apiKey, string secOptions, string IV = "" ) : string

Encrypt a string containing JSON formatted Security Options to create a scoped key.

Private Methods

Method Description
ByteToHex ( byte a ) : string
ConvertKey ( string apiKey ) : byte[]

Convert an apiKey string to a byte array.

GetAes ( byte Key, string IV ) : Aes

Set up an Aes instance with the correct mode, key and IV

HexToByte ( string hex ) : byte[]
RemovePadding ( string text ) : string

Remove PKCS5/7 padding

Method Details

Decrypt() public static method

Decrypt an existing scoped key.
public static Decrypt ( string apiKey, string scopedKey ) : string
apiKey string Master API key
scopedKey string Scoped key to be decrypted
return string

Encrypt() public static method

Encrypt an object containing security options to create a scoped key.
public static Encrypt ( string apiKey, object secOptions, string IV = "" ) : string
apiKey string Master API key
secOptions object An object that can be serialized to produce JSON formatted Security Options
IV string Optional IV, normally not required
return string

EncryptString() public static method

Encrypt a string containing JSON formatted Security Options to create a scoped key.
public static EncryptString ( string apiKey, string secOptions, string IV = "" ) : string
apiKey string Master API key
secOptions string Security Options in JSON format
IV string Optional IV, normally not required
return string