/// <summary> /// Initializes the asymmetric key. /// </summary> protected void InitializeHashKey() { if (!IsHashKeyInitialized) { if (KeyStorage.KeyLocationExists(KeyLocation)) { DecryptHashKey( KeyStorage.GetKey(KeyLocation)); } else { KeyStorage.PutKey(EncryptHashKey(), KeyLocation); } IsHashKeyInitialized = true; } _hashAlgorithm.Initialize(); }
/// <summary> /// Initializes the symmetric key for encryption. /// </summary> protected virtual void InitializeSymmetricKey() { if (IsSymmetricKeyInitialized) { return; } // get or create and put the file from/to its physical location if (KeyStorage.KeyLocationExists(KeyLocation)) { DecryptSymmetricKey(KeyStorage.GetKey(KeyLocation)); } else { Symmetric.GenerateKey(); KeyStorage.PutKey(EncryptSymmetricKey(), KeyLocation); } IsSymmetricKeyInitialized = true; }