blob: eb6c0654c2a5eb430a6c680b439ecc20935634c8 (
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
|
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)
{
return Asn1Utilities.GetInstanceFromChoice(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;
}
}
|