/// <summary> /// Initializes a new instance of <see cref="SignatureAlgorithm"/>. /// </summary> /// <param name="id"></param> /// <param name="name"></param> /// <param name="category"></param> /// <param name="requiredKeySizeInBits"></param> /// <param name="hashAlgorithm"></param> public SignatureAlgorithm(int id, string name, AlgorithmCategory category, ushort requiredKeySizeInBits, HashAlgorithmName hashAlgorithm) { _id = id; _utf8Name = Utf8.GetBytes(name); _category = category; _requiredKeySizeInBits = requiredKeySizeInBits; _hashAlgorithm = hashAlgorithm; }
/// <summary> /// Initializes a new instance of <see cref="KeyManagementAlgorithm"/>. /// </summary> /// <param name="id"></param> /// <param name="name"></param> /// <param name="keyType"></param> /// <param name="requiredKeySizeInBits"></param> /// <param name="wrappedAlgorithm"></param> /// <param name="produceEncryptedKey"></param> public KeyManagementAlgorithm(byte id, string name, AlgorithmCategory keyType, ushort requiredKeySizeInBits, KeyManagementAlgorithm?wrappedAlgorithm, bool produceEncryptedKey) { _id = id; _utf8Name = Utf8.GetBytes(name); _category = keyType; _requiredKeySizeInBits = requiredKeySizeInBits; _wrappedAlgorithm = wrappedAlgorithm; _produceEncryptionKey = produceEncryptedKey; }
/// <summary>Initializes a new instance of <see cref="KeyManagementAlgorithm"/>. </summary> public KeyManagementAlgorithm(AlgorithmId id, string name, AlgorithmCategory keyType, ushort requiredKeySizeInBits, KeyManagementAlgorithm?wrappedAlgorithm, Sha2?sha2, bool produceEncryptedKey) { _id = id; _utf8Name = JsonEncodedText.Encode(name, JsonSerializationBehavior.JsonEncoder); _category = keyType; _requiredKeySizeInBits = requiredKeySizeInBits; _wrappedAlgorithm = wrappedAlgorithm; _produceEncryptionKey = produceEncryptedKey; _sha2 = sha2; }
/// <summary>Initializes a new instance of <see cref="SignatureAlgorithm"/>. </summary> public SignatureAlgorithm(AlgorithmId id, string name, AlgorithmCategory category, ushort requiredKeySizeInBits, HashAlgorithmName hashAlgorithm) { _id = id; _name = JsonEncodedText.Encode(name); _category = category; _requiredKeySizeInBits = requiredKeySizeInBits; _hashAlgorithm = hashAlgorithm; _sha = hashAlgorithm.Name switch { "SHA256" => Sha256.Shared, "SHA384" => Sha384.Shared, "SHA512" => Sha512.Shared, _ => ShaNull.Shared }; }
/// <summary>Initializes a new instance of <see cref="KeyManagementAlgorithm"/>. </summary> public KeyManagementAlgorithm(AlgorithmId id, string name, AlgorithmCategory keyType, bool produceEncryptedKey) : this(id, name, keyType, requiredKeySizeInBits : 0, wrappedAlgorithm : null, sha2 : null, produceEncryptedKey) { }
/// <summary>Initializes a new instance of <see cref="KeyManagementAlgorithm"/>. </summary> public KeyManagementAlgorithm(AlgorithmId id, string name, AlgorithmCategory keyType, KeyManagementAlgorithm wrappedAlgorithm, Sha2 sha2) : this(id, name, keyType, requiredKeySizeInBits : 0, wrappedAlgorithm, sha2 : sha2, produceEncryptedKey : true) { }
/// <summary> /// Initializes a new instance of <see cref="KeyManagementAlgorithm"/>. /// </summary> /// <param name="id"></param> /// <param name="name"></param> /// <param name="keyType"></param> /// <param name="requiredKeySizeInBits"></param> public KeyManagementAlgorithm(byte id, string name, AlgorithmCategory keyType, ushort requiredKeySizeInBits) : this(id, name, keyType, requiredKeySizeInBits, wrappedAlgorithm : null, produceEncryptedKey : true) { }
/// <summary> /// Initializes a new instance of <see cref="KeyManagementAlgorithm"/>. /// </summary> /// <param name="id"></param> /// <param name="name"></param> /// <param name="keyType"></param> /// <param name="wrappedAlgorithm"></param> public KeyManagementAlgorithm(byte id, string name, AlgorithmCategory keyType, KeyManagementAlgorithm?wrappedAlgorithm) : this(id, name, keyType, requiredKeySizeInBits : 0, wrappedAlgorithm, produceEncryptedKey : true) { }
public async Task UpdateAlgorithmCategoryAsync(AlgorithmCategory algorithmCategory) { _context.Entry(algorithmCategory).State = EntityState.Modified; await _context.SaveChangesAsync(); }
public async Task AddAlgorithmCategoryAsync(AlgorithmCategory algorithmCategory) { _context.AlgorithmCategory.Add(algorithmCategory); await _context.SaveChangesAsync(); }