56 lines
2.3 KiB
C#
56 lines
2.3 KiB
C#
using System;
|
|
using System.IO;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Pkcs
|
|
{
|
|
// Token: 0x02001992 RID: 6546
|
|
[Token(Token = "0x2001992")]
|
|
public class Pkcs12Utilities
|
|
{
|
|
// Token: 0x06009C68 RID: 40040 RVA: 0x002097C4 File Offset: 0x002079C4
|
|
[Token(Token = "0x6009C68")]
|
|
[Address(RVA = "0x1CC80C0", Offset = "0x1CC6EC0", VA = "0x181CC80C0")]
|
|
public static byte[] ConvertToDefiniteLength(byte[] berPkcs12File)
|
|
{
|
|
return new Pfx(Asn1Sequence.GetInstance(Asn1Object.FromByteArray(berPkcs12File))).GetEncoded("DER");
|
|
}
|
|
|
|
// Token: 0x06009C69 RID: 40041 RVA: 0x002097F4 File Offset: 0x002079F4
|
|
[Token(Token = "0x6009C69")]
|
|
[Address(RVA = "0x1CC7D10", Offset = "0x1CC6B10", VA = "0x181CC7D10")]
|
|
public static byte[] ConvertToDefiniteLength(byte[] berPkcs12File, char[] passwd)
|
|
{
|
|
Pfx pfx = new Pfx(Asn1Sequence.GetInstance(Asn1Object.FromByteArray(berPkcs12File)));
|
|
ContentInfo contentInfo = pfx.contentInfo;
|
|
Stream octetStream = Asn1OctetString.GetInstance(contentInfo.content).GetOctetStream();
|
|
DerObjectIdentifier contentType = contentInfo.contentType;
|
|
Asn1Object asn1Object;
|
|
DerOctetString derOctetString = new DerOctetString(asn1Object.GetEncoded("DER"));
|
|
ContentInfo contentInfo2 = new ContentInfo(contentType, derOctetString);
|
|
MacData macData = pfx.macData;
|
|
int intValue = macData.iterationCount.IntValue;
|
|
Stream octetStream2 = Asn1OctetString.GetInstance(contentInfo2.content).GetOctetStream();
|
|
Asn1Object asn1Object2 = macData.digInfo.algID.ToAsn1Object();
|
|
byte[] salt = macData.GetSalt();
|
|
Asn1Object asn1Object3 = macData.digInfo.algID.ToAsn1Object();
|
|
AlgorithmIdentifier algorithmIdentifier;
|
|
byte[] array;
|
|
DigestInfo digestInfo = new DigestInfo(algorithmIdentifier, array);
|
|
byte[] salt2 = macData.GetSalt();
|
|
MacData macData2 = new MacData(digestInfo, salt2, intValue);
|
|
return new Pfx(contentInfo2, macData2).GetEncoded("DER");
|
|
}
|
|
|
|
// Token: 0x06009C6A RID: 40042 RVA: 0x002098E4 File Offset: 0x00207AE4
|
|
[Token(Token = "0x6009C6A")]
|
|
[Address(RVA = "0x3F5100", Offset = "0x3F3F00", VA = "0x1803F5100")]
|
|
public Pkcs12Utilities()
|
|
{
|
|
}
|
|
}
|
|
}
|