B-Arts DocumentationIndice generale

BCrypterLegacy - Esempi

Lettura e migrazione di un valore esistente

using B.BSecurity;

string clearText = BCrypterLegacy.Decrypt(legacyCipherText);
string currentCipherText = BCrypter.Encrypt(clearText);

// Salvare currentCipherText al posto del valore precedente.

BCrypterLegacy serve per la compatibilità con valori prodotti dal precedente algoritmo Rijndael/PBKDF2. Per nuove cifrature usare BCrypter.

Password di cifratura specifica

try
{
  BCrypterLegacy.SetCryptPassword(legacyPassword);
  string clearText = BCrypterLegacy.Decrypt(legacyCipherText);
}
finally
{
  BCrypterLegacy.ResetCryptPassword();
}

La password è statica e condivisa dall'intero processo. Ripristinarla subito ed evitare modifiche concorrenti durante l'operazione.