mirrored from https://www.bouncycastle.org/repositories/bc-csharp
-
Notifications
You must be signed in to change notification settings - Fork 602
Expand file tree
/
Copy pathX509KeyUsage.cs
More file actions
49 lines (45 loc) · 1.53 KB
/
Copy pathX509KeyUsage.cs
File metadata and controls
49 lines (45 loc) · 1.53 KB
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
using Org.BouncyCastle.Asn1;
using Org.BouncyCastle.Asn1.X509;
namespace Org.BouncyCastle.X509
{
/// <summary>A holding class for constructing an X509 Key Usage extension.</summary>
/// <remarks>
/// <code>
/// id-ce - keyUsage OBJECT IDENTIFIER ::= { id - ce 15 }
///
/// KeyUsage ::= BIT STRING {
/// digitalSignature(0),
/// nonRepudiation(1),
/// keyEncipherment(2),
/// dataEncipherment(3),
/// keyAgreement(4),
/// keyCertSign(5),
/// cRLSign(6),
/// encipherOnly(7),
/// decipherOnly(8) }
/// </code>
/// </remarks>
public class X509KeyUsage
: Asn1Encodable
{
public const int DigitalSignature = 1 << 7;
public const int NonRepudiation = 1 << 6;
public const int KeyEncipherment = 1 << 5;
public const int DataEncipherment = 1 << 4;
public const int KeyAgreement = 1 << 3;
public const int KeyCertSign = 1 << 2;
public const int CrlSign = 1 << 1;
public const int EncipherOnly = 1 << 0;
public const int DecipherOnly = 1 << 15;
private readonly int m_usage;
/// <param name="usage">
/// The bitwise OR of the Key Usage flags giving the allowed uses for the key.
/// e.g. (X509KeyUsage.keyEncipherment | X509KeyUsage.dataEncipherment).
/// </param>
public X509KeyUsage(int usage)
{
m_usage = usage;
}
public override Asn1Object ToAsn1Object() => new KeyUsage(m_usage);
}
}