58 lines
2.3 KiB
C#
58 lines
2.3 KiB
C#
using System;
|
|
using System.IO;
|
|
using System.Runtime.InteropServices;
|
|
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: 0x020013B5 RID: 5045
|
|
[Token(Token = "0x20013B5")]
|
|
[StructLayout(3)]
|
|
public class Pkcs12Utilities
|
|
{
|
|
// Token: 0x0600808E RID: 32910 RVA: 0x001B2544 File Offset: 0x001B0744
|
|
[Token(Token = "0x600808E")]
|
|
[Address(RVA = "0x4E8CA0", Offset = "0x4E76A0", VA = "0x1804E8CA0")]
|
|
public static byte[] ConvertToDefiniteLength(byte[] berPkcs12File)
|
|
{
|
|
return new Pfx(Asn1Sequence.GetInstance(Asn1Object.FromByteArray(berPkcs12File))).GetEncoded("DER");
|
|
}
|
|
|
|
// Token: 0x0600808F RID: 32911 RVA: 0x001B2574 File Offset: 0x001B0774
|
|
[Token(Token = "0x600808F")]
|
|
[Address(RVA = "0x4E88F0", Offset = "0x4E72F0", VA = "0x1804E88F0")]
|
|
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: 0x06008090 RID: 32912 RVA: 0x001B2664 File Offset: 0x001B0864
|
|
[Token(Token = "0x6008090")]
|
|
[Address(RVA = "0x3C1670", Offset = "0x3C0070", VA = "0x1803C1670")]
|
|
public Pkcs12Utilities()
|
|
{
|
|
}
|
|
}
|
|
}
|