add all
This commit is contained in:
67
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/AuthenticatedSafe.cs
vendored
Normal file
67
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/AuthenticatedSafe.cs
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs
|
||||
{
|
||||
public class AuthenticatedSafe
|
||||
: Asn1Encodable
|
||||
{
|
||||
private static ContentInfo[] Copy(ContentInfo[] info)
|
||||
{
|
||||
return (ContentInfo[])info.Clone();
|
||||
}
|
||||
|
||||
public static AuthenticatedSafe GetInstance(object obj)
|
||||
{
|
||||
if (obj is AuthenticatedSafe)
|
||||
return (AuthenticatedSafe)obj;
|
||||
if (obj == null)
|
||||
return null;
|
||||
return new AuthenticatedSafe(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
private readonly ContentInfo[] info;
|
||||
private readonly bool isBer;
|
||||
|
||||
private AuthenticatedSafe(Asn1Sequence seq)
|
||||
{
|
||||
info = new ContentInfo[seq.Count];
|
||||
|
||||
for (int i = 0; i != info.Length; i++)
|
||||
{
|
||||
info[i] = ContentInfo.GetInstance(seq[i]);
|
||||
}
|
||||
|
||||
isBer = seq is BerSequence;
|
||||
}
|
||||
|
||||
public AuthenticatedSafe(
|
||||
ContentInfo[] info)
|
||||
{
|
||||
this.info = Copy(info);
|
||||
this.isBer = true;
|
||||
}
|
||||
|
||||
public ContentInfo[] GetContentInfo()
|
||||
{
|
||||
return Copy(info);
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
if (isBer)
|
||||
{
|
||||
return new BerSequence(info);
|
||||
}
|
||||
|
||||
// TODO bc-java uses DL sequence
|
||||
//return new DLSequence(info);
|
||||
return new DerSequence(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
Reference in New Issue
Block a user