scripts
This commit is contained in:
+263
@@ -0,0 +1,263 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Runtime.InteropServices;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Ess;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Tsp;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Cms;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Math;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.X509;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.X509.Store;
|
||||
using Cpp2IlInjected;
|
||||
|
||||
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Tsp
|
||||
{
|
||||
// Token: 0x02001393 RID: 5011
|
||||
[Token(Token = "0x2001393")]
|
||||
[StructLayout(3)]
|
||||
public class TimeStampTokenGenerator
|
||||
{
|
||||
// Token: 0x06007EFE RID: 32510 RVA: 0x001A9F14 File Offset: 0x001A8114
|
||||
[Token(Token = "0x6007EFE")]
|
||||
[Address(RVA = "0x1C6BF20", Offset = "0x1C6A920", VA = "0x181C6BF20")]
|
||||
public TimeStampTokenGenerator(AsymmetricKeyParameter key, X509Certificate cert, string digestOID, string tsaPolicyOID)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06007EFF RID: 32511 RVA: 0x001A9F24 File Offset: 0x001A8124
|
||||
[Token(Token = "0x6007EFF")]
|
||||
[Address(RVA = "0x1C6BC40", Offset = "0x1C6A640", VA = "0x181C6BC40")]
|
||||
public TimeStampTokenGenerator(AsymmetricKeyParameter key, X509Certificate cert, string digestOID, string tsaPolicyOID, BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.AttributeTable signedAttr, BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.AttributeTable unsignedAttr)
|
||||
{
|
||||
this.accuracySeconds = (int)((ulong)(-1L));
|
||||
this.accuracyMicros = (int)((ulong)4294967295L);
|
||||
base..ctor();
|
||||
this.key = key;
|
||||
this.cert = cert;
|
||||
this.digestOID = digestOID;
|
||||
this.tsaPolicyOID = 0;
|
||||
this.unsignedAttr = 0;
|
||||
TspUtil.ValidateCertificate(cert);
|
||||
if (cert == 0)
|
||||
{
|
||||
IDictionary dictionary = Platform.CreateHashtable();
|
||||
}
|
||||
AsymmetricKeyParameter publicKey = cert.GetPublicKey();
|
||||
byte[] array;
|
||||
EssCertID essCertID = new EssCertID(array);
|
||||
DerObjectIdentifier idAASigningCertificate = PkcsObjectIdentifiers.IdAASigningCertificate;
|
||||
DerSet derSet = new DerSet(new SigningCertificate(essCertID));
|
||||
BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.Attribute attribute = new BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.Attribute(idAASigningCertificate, derSet);
|
||||
IDictionary dictionary2;
|
||||
BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.AttributeTable attributeTable = new BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.AttributeTable(dictionary2);
|
||||
this.signedAttr = attributeTable;
|
||||
}
|
||||
|
||||
// Token: 0x06007F00 RID: 32512 RVA: 0x001A9FF8 File Offset: 0x001A81F8
|
||||
[Token(Token = "0x6007F00")]
|
||||
[Address(RVA = "0x3EDEB0", Offset = "0x3EC8B0", VA = "0x1803EDEB0")]
|
||||
public void SetCertificates(IX509Store certificates)
|
||||
{
|
||||
this.x509Certs = certificates;
|
||||
}
|
||||
|
||||
// Token: 0x06007F01 RID: 32513 RVA: 0x001AA00C File Offset: 0x001A820C
|
||||
[Token(Token = "0x6007F01")]
|
||||
[Address(RVA = "0x3EDEC0", Offset = "0x3EC8C0", VA = "0x1803EDEC0")]
|
||||
public void SetCrls(IX509Store crls)
|
||||
{
|
||||
this.x509Crls = crls;
|
||||
}
|
||||
|
||||
// Token: 0x06007F02 RID: 32514 RVA: 0x001AA020 File Offset: 0x001A8220
|
||||
[Token(Token = "0x6007F02")]
|
||||
[Address(RVA = "0x3C1C90", Offset = "0x3C0690", VA = "0x1803C1C90")]
|
||||
public void SetAccuracySeconds(int accuracySeconds)
|
||||
{
|
||||
this.accuracySeconds = accuracySeconds;
|
||||
}
|
||||
|
||||
// Token: 0x06007F03 RID: 32515 RVA: 0x001AA034 File Offset: 0x001A8234
|
||||
[Token(Token = "0x6007F03")]
|
||||
[Address(RVA = "0x55D5D0", Offset = "0x55BFD0", VA = "0x18055D5D0")]
|
||||
public void SetAccuracyMillis(int accuracyMillis)
|
||||
{
|
||||
this.accuracyMillis = accuracyMillis;
|
||||
}
|
||||
|
||||
// Token: 0x06007F04 RID: 32516 RVA: 0x001AA048 File Offset: 0x001A8248
|
||||
[Token(Token = "0x6007F04")]
|
||||
[Address(RVA = "0x4F8C20", Offset = "0x4F7620", VA = "0x1804F8C20")]
|
||||
public void SetAccuracyMicros(int accuracyMicros)
|
||||
{
|
||||
this.accuracyMicros = accuracyMicros;
|
||||
}
|
||||
|
||||
// Token: 0x06007F05 RID: 32517 RVA: 0x001AA05C File Offset: 0x001A825C
|
||||
[Token(Token = "0x6007F05")]
|
||||
[Address(RVA = "0xF12400", Offset = "0xF10E00", VA = "0x180F12400")]
|
||||
public void SetOrdering(bool ordering)
|
||||
{
|
||||
this.ordering = ordering;
|
||||
}
|
||||
|
||||
// Token: 0x06007F06 RID: 32518 RVA: 0x001AA070 File Offset: 0x001A8270
|
||||
[Token(Token = "0x6007F06")]
|
||||
[Address(RVA = "0x3C1260", Offset = "0x3BFC60", VA = "0x1803C1260")]
|
||||
public void SetTsa(GeneralName tsa)
|
||||
{
|
||||
this.tsa = tsa;
|
||||
}
|
||||
|
||||
// Token: 0x06007F07 RID: 32519 RVA: 0x001AA084 File Offset: 0x001A8284
|
||||
[Token(Token = "0x6007F07")]
|
||||
[Address(RVA = "0x1C6B5D0", Offset = "0x1C69FD0", VA = "0x181C6B5D0")]
|
||||
public TimeStampToken Generate(TimeStampRequest request, BigInteger serialNumber, DateTime genTime)
|
||||
{
|
||||
Asn1Object asn1Object = request.req.messageImprint.hashAlgorithm.ToAsn1Object();
|
||||
DerNull instance = DerNull.Instance;
|
||||
DerObjectIdentifier derObjectIdentifier;
|
||||
AlgorithmIdentifier algorithmIdentifier = new AlgorithmIdentifier(derObjectIdentifier, instance);
|
||||
byte[] hashedMessage = request.req.messageImprint.hashedMessage;
|
||||
MessageImprint messageImprint = new MessageImprint(algorithmIdentifier, hashedMessage);
|
||||
int num = this.accuracySeconds;
|
||||
if (this.accuracyMicros > 0)
|
||||
{
|
||||
int num2 = 0;
|
||||
if (num > 0)
|
||||
{
|
||||
DerInteger derInteger = new DerInteger(num);
|
||||
}
|
||||
int num3 = this.accuracyMillis;
|
||||
DerInteger derInteger2;
|
||||
if (num3 > 0)
|
||||
{
|
||||
derInteger2 = new DerInteger(num3);
|
||||
}
|
||||
int num4 = this.accuracyMicros;
|
||||
DerInteger derInteger3;
|
||||
if (num4 > 0)
|
||||
{
|
||||
derInteger3 = new DerInteger(num3);
|
||||
}
|
||||
Accuracy accuracy = new Accuracy(num2, derInteger2, derInteger3);
|
||||
}
|
||||
bool flag = this.ordering;
|
||||
if (flag)
|
||||
{
|
||||
DerBoolean instance2 = DerBoolean.GetInstance(flag);
|
||||
}
|
||||
DerInteger nonce = request.req.nonce;
|
||||
if (nonce != 0 && nonce.Value != 0)
|
||||
{
|
||||
DerInteger nonce2 = request.req.nonce;
|
||||
if (nonce2 == 0)
|
||||
{
|
||||
}
|
||||
DerInteger derInteger4 = new DerInteger(nonce2.Value);
|
||||
}
|
||||
DerObjectIdentifier derObjectIdentifier2 = new DerObjectIdentifier(this.tsaPolicyOID);
|
||||
DerObjectIdentifier tsaPolicy = request.req.tsaPolicy;
|
||||
if (tsaPolicy != 0)
|
||||
{
|
||||
string identifier = tsaPolicy.identifier;
|
||||
if (identifier != 0)
|
||||
{
|
||||
DerObjectIdentifier derObjectIdentifier3 = new DerObjectIdentifier(identifier);
|
||||
}
|
||||
}
|
||||
DerGeneralizedTime derGeneralizedTime = new DerGeneralizedTime(genTime);
|
||||
X509Extensions extensions = request.req.extensions;
|
||||
CmsSignedDataGenerator cmsSignedDataGenerator = new CmsSignedDataGenerator();
|
||||
TstInfo tstInfo;
|
||||
byte[] derEncoded = tstInfo.GetDerEncoded();
|
||||
DerBoolean certReq = request.req.certReq;
|
||||
if (certReq != 0 && certReq.IsTrue)
|
||||
{
|
||||
IX509Store ix509Store = this.x509Certs;
|
||||
cmsSignedDataGenerator.AddCertificates(ix509Store);
|
||||
}
|
||||
IX509Store ix509Store2 = this.x509Crls;
|
||||
cmsSignedDataGenerator.AddCrls(ix509Store2);
|
||||
BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.AttributeTable attributeTable = this.signedAttr;
|
||||
BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.AttributeTable attributeTable2 = this.unsignedAttr;
|
||||
string text = this.digestOID;
|
||||
X509Certificate x509Certificate = this.cert;
|
||||
AsymmetricKeyParameter asymmetricKeyParameter = this.key;
|
||||
cmsSignedDataGenerator.AddSigner(asymmetricKeyParameter, x509Certificate, text, attributeTable, attributeTable2);
|
||||
string identifier2 = PkcsObjectIdentifiers.IdCTTstInfo.identifier;
|
||||
CmsProcessableByteArray cmsProcessableByteArray = new CmsProcessableByteArray(derEncoded);
|
||||
return new TimeStampToken(cmsSignedDataGenerator.Generate(identifier2, cmsProcessableByteArray, true));
|
||||
}
|
||||
|
||||
// Token: 0x04005A81 RID: 23169
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
||||
[Token(Token = "0x4005A81")]
|
||||
private int accuracySeconds;
|
||||
|
||||
// Token: 0x04005A82 RID: 23170
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x14")]
|
||||
[Token(Token = "0x4005A82")]
|
||||
private int accuracyMillis;
|
||||
|
||||
// Token: 0x04005A83 RID: 23171
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
||||
[Token(Token = "0x4005A83")]
|
||||
private int accuracyMicros;
|
||||
|
||||
// Token: 0x04005A84 RID: 23172
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x1C")]
|
||||
[Token(Token = "0x4005A84")]
|
||||
private bool ordering;
|
||||
|
||||
// Token: 0x04005A85 RID: 23173
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
||||
[Token(Token = "0x4005A85")]
|
||||
private GeneralName tsa;
|
||||
|
||||
// Token: 0x04005A86 RID: 23174
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
|
||||
[Token(Token = "0x4005A86")]
|
||||
private string tsaPolicyOID;
|
||||
|
||||
// Token: 0x04005A87 RID: 23175
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x30")]
|
||||
[Token(Token = "0x4005A87")]
|
||||
private AsymmetricKeyParameter key;
|
||||
|
||||
// Token: 0x04005A88 RID: 23176
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x38")]
|
||||
[Token(Token = "0x4005A88")]
|
||||
private X509Certificate cert;
|
||||
|
||||
// Token: 0x04005A89 RID: 23177
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x40")]
|
||||
[Token(Token = "0x4005A89")]
|
||||
private string digestOID;
|
||||
|
||||
// Token: 0x04005A8A RID: 23178
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x48")]
|
||||
[Token(Token = "0x4005A8A")]
|
||||
private BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.AttributeTable signedAttr;
|
||||
|
||||
// Token: 0x04005A8B RID: 23179
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x50")]
|
||||
[Token(Token = "0x4005A8B")]
|
||||
private BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.AttributeTable unsignedAttr;
|
||||
|
||||
// Token: 0x04005A8C RID: 23180
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x58")]
|
||||
[Token(Token = "0x4005A8C")]
|
||||
private IX509Store x509Certs;
|
||||
|
||||
// Token: 0x04005A8D RID: 23181
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x60")]
|
||||
[Token(Token = "0x4005A8D")]
|
||||
private IX509Store x509Crls;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user