blob: 809a757ac8b03058364e173186a022c21c7aa014 (
plain) (
blame)
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
|
using System;
using Org.BouncyCastle.Utilities;
namespace Org.BouncyCastle.Asn1.Esf
{
/// <remarks>
/// <code>
/// SignaturePolicyIdentifier ::= CHOICE {
/// SignaturePolicyId SignaturePolicyId,
/// SignaturePolicyImplied SignaturePolicyImplied
/// }
///
/// SignaturePolicyImplied ::= NULL
/// </code>
/// </remarks>
public class SignaturePolicyIdentifier
: Asn1Encodable, IAsn1Choice
{
public static SignaturePolicyIdentifier GetInstance(object obj)
{
if (obj == null)
return null;
if (obj is SignaturePolicyIdentifier signaturePolicyIdentifier)
return signaturePolicyIdentifier;
if (obj is Asn1Null)
return new SignaturePolicyIdentifier();
return new SignaturePolicyIdentifier(SignaturePolicyId.GetInstance(obj));
}
public static SignaturePolicyIdentifier GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit) =>
Asn1Utilities.GetInstanceChoice(taggedObject, declaredExplicit, GetInstance);
public static SignaturePolicyIdentifier GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) =>
Asn1Utilities.GetTaggedChoice(taggedObject, declaredExplicit, GetInstance);
private readonly SignaturePolicyId m_sigPolicy;
public SignaturePolicyIdentifier()
{
m_sigPolicy = null;
}
public SignaturePolicyIdentifier(SignaturePolicyId signaturePolicyId)
{
m_sigPolicy = signaturePolicyId ?? throw new ArgumentNullException(nameof(signaturePolicyId));
}
public SignaturePolicyId SignaturePolicyId => m_sigPolicy;
public override Asn1Object ToAsn1Object() => m_sigPolicy?.ToAsn1Object() ?? DerNull.Instance;
}
}
|