/
CngKeyCreationParameters.cs
70 lines (59 loc) · 2.09 KB
/
CngKeyCreationParameters.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
namespace System.Security.Cryptography
{
/// <summary>
/// Contains advanced properties for key creation.
/// </summary>
public sealed class CngKeyCreationParameters
{
public CngKeyCreationParameters()
{
Provider = CngProvider.MicrosoftSoftwareKeyStorageProvider;
Parameters = new CngPropertyCollection();
}
/// <summary>
/// How many times can this key be exported from the KSP
/// </summary>
public CngExportPolicies? ExportPolicy { get; set; }
/// <summary>
/// Flags controlling how to create the key
/// </summary>
public CngKeyCreationOptions KeyCreationOptions { get; set; }
/// <summary>
/// Which cryptographic operations are valid for use with this key
/// </summary>
public CngKeyUsages? KeyUsage { get; set; }
/// <summary>
/// Extra parameter values to set before the key is finalized
/// </summary>
public CngPropertyCollection Parameters { get; private set; }
/// <summary>
/// Window handle to use as the parent for the dialog shown when the key is created
/// </summary>
public IntPtr ParentWindowHandle { get; set; }
/// <summary>
/// KSP to create the key in
/// </summary>
public CngProvider Provider
{
get
{
return _provider;
}
set
{
ArgumentNullException.ThrowIfNull(value);
_provider = value;
}
}
/// <summary>
/// Settings for UI shown on access to the key
/// </summary>
public CngUIPolicy? UIPolicy { get; set; }
private CngProvider _provider = null!; // will be initialized via property setter called by ctor
}
}