You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
2.0 KiB
80 lines
2.0 KiB
1 year ago
|
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||
|
#pragma warning disable
|
||
|
using System;
|
||
|
|
||
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||
|
{
|
||
|
public class PolicyInformation
|
||
|
: Asn1Encodable
|
||
|
{
|
||
|
private readonly DerObjectIdentifier policyIdentifier;
|
||
|
private readonly Asn1Sequence policyQualifiers;
|
||
|
|
||
|
private PolicyInformation(
|
||
|
Asn1Sequence seq)
|
||
|
{
|
||
|
if (seq.Count < 1 || seq.Count > 2)
|
||
|
{
|
||
|
throw new ArgumentException("Bad sequence size: " + seq.Count);
|
||
|
}
|
||
|
|
||
|
policyIdentifier = DerObjectIdentifier.GetInstance(seq[0]);
|
||
|
|
||
|
if (seq.Count > 1)
|
||
|
{
|
||
|
policyQualifiers = Asn1Sequence.GetInstance(seq[1]);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public PolicyInformation(
|
||
|
DerObjectIdentifier policyIdentifier)
|
||
|
{
|
||
|
this.policyIdentifier = policyIdentifier;
|
||
|
}
|
||
|
|
||
|
public PolicyInformation(
|
||
|
DerObjectIdentifier policyIdentifier,
|
||
|
Asn1Sequence policyQualifiers)
|
||
|
{
|
||
|
this.policyIdentifier = policyIdentifier;
|
||
|
this.policyQualifiers = policyQualifiers;
|
||
|
}
|
||
|
|
||
|
public static PolicyInformation GetInstance(
|
||
|
object obj)
|
||
|
{
|
||
|
if (obj == null || obj is PolicyInformation)
|
||
|
{
|
||
|
return (PolicyInformation) obj;
|
||
|
}
|
||
|
|
||
|
return new PolicyInformation(Asn1Sequence.GetInstance(obj));
|
||
|
}
|
||
|
|
||
|
public DerObjectIdentifier PolicyIdentifier
|
||
|
{
|
||
|
get { return policyIdentifier; }
|
||
|
}
|
||
|
|
||
|
public Asn1Sequence PolicyQualifiers
|
||
|
{
|
||
|
get { return policyQualifiers; }
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
* PolicyInformation ::= Sequence {
|
||
|
* policyIdentifier CertPolicyId,
|
||
|
* policyQualifiers Sequence SIZE (1..MAX) OF
|
||
|
* PolicyQualifierInfo OPTIONAL }
|
||
|
*/
|
||
|
public override Asn1Object ToAsn1Object()
|
||
|
{
|
||
|
Asn1EncodableVector v = new Asn1EncodableVector(policyIdentifier);
|
||
|
v.AddOptional(policyQualifiers);
|
||
|
return new DerSequence(v);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
#pragma warning restore
|
||
|
#endif
|