Advtools.AdvInterceptor.CertificatesManager.BuildPkcs12 C# (CSharp) Method

BuildPkcs12() private method

private BuildPkcs12 ( byte raw, RSA key ) : PKCS12
raw byte
key System.Security.Cryptography.RSA
return Mono.Security.X509.PKCS12
        private PKCS12 BuildPkcs12(byte[] raw, RSA key)
        {
            PKCS12 p12 = new PKCS12();
            p12.Password = "advtools";

            ArrayList list = new ArrayList();
            // we use a fixed array to avoid endianess issues (in case some tools requires the ID to be 1).
            list.Add(new byte[4] { 1, 0, 0, 0 });
            Hashtable attributes = new Hashtable(1);
            attributes.Add(PKCS9.localKeyId, list);

            p12.AddCertificate(new X509Certificate(raw), attributes);
            p12.AddPkcs8ShroudedKeyBag(key, attributes);

            return p12;
        }