Class EncryptionKey
Key container for the store of the key
Inheritance
Inherited Members
Namespace: VEDriversLite.Security
Assembly: VEDriversLite.dll
Syntax
public class EncryptionKey
Constructors
| Improve this Doc View SourceEncryptionKey()
Declaration
public EncryptionKey()
EncryptionKey(String, Byte[], String, Boolean)
Declaration
public EncryptionKey(string key, byte[] iv, string password = "", bool fromDb = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | |
System.Byte[] | iv | |
System.String | password | |
System.Boolean | fromDb |
EncryptionKey(String, String, Boolean)
Constructor to load the key
Declaration
public EncryptionKey(string key, string password = "", bool fromDb = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | key in raw form. If it is already encrypted please set fromDb flag |
System.String | password | password to encrypt the key during the load to this container |
System.Boolean | fromDb | if this is set it will not encrypt the key with the provided password and just store key as it is. Pass must be loaded separately |
Properties
| Improve this Doc View SourceDeleted
was key deleted
Declaration
public bool Deleted { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Id
ID of this key
Declaration
public Guid Id { get; set; }
Property Value
Type | Description |
---|---|
System.Guid |
IsEncrypted
Is the key encrypted flag
Declaration
public bool IsEncrypted { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsLoaded
Is key loaded? Returns true if the key is not empty or null
Declaration
public bool IsLoaded { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsPassLoaded
Is pass loaded? Returns true if the pass is loaded
Declaration
public bool IsPassLoaded { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IV
IV
Declaration
public byte[] IV { get; set; }
Property Value
Type | Description |
---|---|
System.Byte[] |
Name
Name of the key
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String |
PasswordHash
Password hash
Declaration
public byte[] PasswordHash { get; }
Property Value
Type | Description |
---|---|
System.Byte[] |
PasswordHashString
Declaration
public string PasswordHashString { get; }
Property Value
Type | Description |
---|---|
System.String |
PublicKey
Public key if there is some
Declaration
public string PublicKey { get; set; }
Property Value
Type | Description |
---|---|
System.String |
RelatedItemId
Related item ID
Declaration
public Guid RelatedItemId { get; set; }
Property Value
Type | Description |
---|---|
System.Guid |
Version
Version of the key
Declaration
public string Version { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceGetEncryptedKey(String, Boolean)
This is confusing, sorry will be renamed soon It returns decrypted key if the pass is loaded. If the pass is not loaded you need to provide pass If you want encrypted form of the key select returnEncrypted=true
Declaration
public string GetEncryptedKey(string password = "", bool returnEncrypted = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | password | fill if the pass is not loaded and you need decrypted key |
System.Boolean | returnEncrypted | set true for return enrcypted form of key |
Returns
Type | Description |
---|---|
System.String |
LoadNewKey(String, String, Boolean)
Load the key and password. Same logic as constructor of this class
Declaration
public async Task<bool> LoadNewKey(string key, string password = "", bool fromDb = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | |
System.String | password | |
System.Boolean | fromDb |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Boolean> |
LoadPassword(String)
Load the password to the container It will set passwordLoaded flag to true
Declaration
public void LoadPassword(string password)
Parameters
Type | Name | Description |
---|---|---|
System.String | password |
Lock()
Lock the account. It will remove the loaded password and set passwordloaded flag to false
Declaration
public void Lock()