上海虹口龙之梦项目
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.
 
 
 
 

100 lines
2.3 KiB

#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Ocsp
{
public class CertStatus
: Asn1Encodable, IAsn1Choice
{
private readonly int tagNo;
private readonly Asn1Encodable value;
/**
* create a CertStatus object with a tag of zero.
*/
public CertStatus()
{
tagNo = 0;
value = DerNull.Instance;
}
public CertStatus(
RevokedInfo info)
{
tagNo = 1;
value = info;
}
public CertStatus(
int tagNo,
Asn1Encodable value)
{
this.tagNo = tagNo;
this.value = value;
}
public CertStatus(
Asn1TaggedObject choice)
{
this.tagNo = choice.TagNo;
switch (choice.TagNo)
{
case 1:
value = RevokedInfo.GetInstance(choice, false);
break;
case 0:
case 2:
value = DerNull.Instance;
break;
default:
throw new ArgumentException("Unknown tag encountered: " + choice.TagNo);
}
}
public static CertStatus GetInstance(
object obj)
{
if (obj == null || obj is CertStatus)
{
return (CertStatus)obj;
}
if (obj is Asn1TaggedObject)
{
return new CertStatus((Asn1TaggedObject)obj);
}
throw new ArgumentException("unknown object in factory: " + BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
}
public int TagNo
{
get { return tagNo; }
}
public Asn1Encodable Status
{
get { return value; }
}
/**
* Produce an object suitable for an Asn1OutputStream.
* <pre>
* CertStatus ::= CHOICE {
* good [0] IMPLICIT Null,
* revoked [1] IMPLICIT RevokedInfo,
* unknown [2] IMPLICIT UnknownInfo }
* </pre>
*/
public override Asn1Object ToAsn1Object()
{
return new DerTaggedObject(false, tagNo, value);
}
}
}
#pragma warning restore
#endif