Esempio n. 1
0
        public static void V_Test_X509_MakeCert()
        {
            Console.WriteLine("Testing X509_MakeCert ...");
            int    nRet                 = 0;
            string strNewCertFile       = null;
            string strIssuerCert        = null;
            string strSubjectPubKeyFile = null;
            string strIssuerPriKeyFile  = null;
            string strPassword          = null;
            int    nCertNum             = 0;
            int    nYearsValid          = 0;
            string strDistName          = null;
            string strEmail             = null;

            strNewCertFile       = "myuser.cer";
            strIssuerCert        = "myca.cer";
            strSubjectPubKeyFile = "myuser.pub";
            strIssuerPriKeyFile  = "myca.epk";
            strPassword          = "******";
            //!!
            nCertNum    = 0x101;
            nYearsValid = 4;
            strDistName = "CN=My User,O=Test Org,OU=Unit,C=AU,L=My Town,S=State,[email protected]";
            strEmail    = "*****@*****.**";

            nRet = X509.MakeCert(strNewCertFile, strIssuerCert, strSubjectPubKeyFile, strIssuerPriKeyFile, nCertNum, nYearsValid, strDistName, strEmail, 0, strPassword,
                                 0);
            if (nRet != 0)
            {
                Console.WriteLine(nRet + " " + General.LastError());
            }
            else
            {
                Console.WriteLine("Success, created X.509 cert " + strNewCertFile);
            }
        }