private void Initialize(byte[] decryptionKey, byte[] validationKey, ShaVersion hashAlgorithm, CompatibilityMode compatibilityMode) { _CompatibilityMode = compatibilityMode; _DecryptionKeyBlob = KeyDerivator.DeriveKey(decryptionKey, _CompatibilityMode); _hasher = HashProvider.Create(KeyDerivator.DeriveKey(validationKey, _CompatibilityMode), hashAlgorithm); }
public static HashProvider Create(byte[] validationKey, ShaVersion hashAlgorithm) { switch (hashAlgorithm) { case ShaVersion.Sha1: return(new Sha1HashProvider(validationKey)); case ShaVersion.Sha512: return(new Sha512HashProvider(validationKey)); default: throw new ArgumentOutOfRangeException(nameof(hashAlgorithm)); } }
private void Initialize(byte[] decryptionKey, byte[] validationKey, ShaVersion hashAlgorithm) { _DecryptionKeyBlob = decryptionKey; _hasher = HashProvider.Create(validationKey, hashAlgorithm); }
public LegacyFormsAuthenticationTicketEncryptor(byte[] decryptionKey, byte[] validationKey, ShaVersion hashAlgorithm = DefaultHashAlgorithm) { Initialize(decryptionKey, validationKey, hashAlgorithm); }
public LegacyFormsAuthenticationTicketEncryptor(string decryptionKey, string validationKey, ShaVersion hashAlgorithm = DefaultHashAlgorithm) { byte[] descriptionKeyBytes = HexUtils.HexToBinary(decryptionKey); byte[] validationKeyBytes = HexUtils.HexToBinary(validationKey); Initialize(descriptionKeyBytes, validationKeyBytes, hashAlgorithm); }
public LegacyFormsAuthenticationTicketEncryptor(byte[] decryptionKey, byte[] validationKey, ShaVersion hashAlgorithm = DefaultHashAlgorithm, CompatibilityMode compatibilityMode = DefaultCompatibilityMode) { Initialize(decryptionKey, validationKey, hashAlgorithm, compatibilityMode); }