培训考核三期,新版培训,网页版培训登录器
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.8 KiB

#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
{
public class AlgorithmIdentifier
: Asn1Encodable
{
private readonly DerObjectIdentifier algorithm;
private readonly Asn1Encodable parameters;
public static AlgorithmIdentifier GetInstance(
Asn1TaggedObject obj,
bool explicitly)
{
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
}
public static AlgorithmIdentifier GetInstance(
object obj)
{
if (obj == null)
return null;
if (obj is AlgorithmIdentifier)
return (AlgorithmIdentifier)obj;
return new AlgorithmIdentifier(Asn1Sequence.GetInstance(obj));
}
public AlgorithmIdentifier(
DerObjectIdentifier algorithm)
{
this.algorithm = algorithm;
}
public AlgorithmIdentifier(
string algorithm)
{
this.algorithm = new DerObjectIdentifier(algorithm);
}
public AlgorithmIdentifier(
DerObjectIdentifier algorithm,
Asn1Encodable parameters)
{
this.algorithm = algorithm;
this.parameters = parameters;
}
internal AlgorithmIdentifier(
Asn1Sequence seq)
{
if (seq.Count < 1 || seq.Count > 2)
throw new ArgumentException("Bad sequence size: " + seq.Count);
this.algorithm = DerObjectIdentifier.GetInstance(seq[0]);
this.parameters = seq.Count < 2 ? null : seq[1];
}
/// <summary>
/// Return the OID in the Algorithm entry of this identifier.
/// </summary>
public virtual DerObjectIdentifier Algorithm
{
get { return algorithm; }
}
public virtual DerObjectIdentifier ObjectID
{
get { return algorithm; }
}
/// <summary>
/// Return the parameters structure in the Parameters entry of this identifier.
/// </summary>
public virtual Asn1Encodable Parameters
{
get { return parameters; }
}
/**
* Produce an object suitable for an Asn1OutputStream.
* <pre>
* AlgorithmIdentifier ::= Sequence {
* algorithm OBJECT IDENTIFIER,
* parameters ANY DEFINED BY algorithm OPTIONAL }
* </pre>
*/
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector(algorithm);
v.AddOptional(parameters);
return new DerSequence(v);
}
}
}
#pragma warning restore
#endif