private void button4_Click(object sender, EventArgs e) { Desko.EPass.Passport passport = Desko.EPass.Framework.Instance.GetPassport(cihaz, Desko.EPass.Types.ShareMode.Direct); passport.Initialize(Desko.EPass.Types.ShareMode.Shared); string fullmrz = mrzl[0] + mrzl[1]; string CSCA_SON = @"C:\Users\hayreddin.bas\Desktop\keys\pasaport sertifikaları\PROD\CSCATR_S1.cer"; string DVCA = @"C:\Users\hayreddin.bas\Documents\silnecekprod\TRDVCAEPASS.cvc"; string iscert = @"C:\Users\hayreddin.bas\Documents\yeni_is\16.cvc"; string is_key = @"C:\Users\hayreddin.bas\Documents\yeni_is\pk2.pkcs8"; Desko.EPass.Certificates.X509Certificate TESTCSCA = new Desko.EPass.Certificates.X509Certificate(FileToByteArray(CSCA_SON)); Desko.EPass.Certificates.CvCertificate DVCAC = new Desko.EPass.Certificates.CvCertificate(FileToByteArray(DVCA)); Desko.EPass.Certificates.CvCertificate certyirmic = new Desko.EPass.Certificates.CvCertificate(FileToByteArray(iscert)); Desko.EPass.CertificateStore.Instance.AddCertificate(TESTCSCA); Desko.EPass.CertificateStore.Instance.AddCertificate(DVCAC); Desko.EPass.CertificateStore.Instance.AddCertificate(certyirmic); byte[] pk = FileToByteArray(is_key); certyirmic.SetCertificateKey(pk); Desko.EPass.Certificates.CertificateInformation info = certyirmic.CertificateInformation; MessageBox.Show(info.ToString()); Desko.EPass.Certificates.CertificateInformation info1 = TESTCSCA.CertificateInformation; MessageBox.Show(info1.ToString()); Desko.EPass.Certificates.CertificateInformation info2 = DVCAC.CertificateInformation; MessageBox.Show(info2.ToString()); CertificateHolderRole role = new CertificateHolderRole(); role = CertificateHolderRole.DomesticDV; Desko.EPass.CertificateStore.Instance.SaveCertificateDatabase("certdbnew"); Desko.EPass.CertificateStore.Instance.LoadCertificateDatabase("certdbnew"); // byte [] key_data = certyirmic.GetPrivateKey(); TerminalAuthenticationMode mode = new TerminalAuthenticationMode(); mode = TerminalAuthenticationMode.LocalStorage; Desko.EPass.Framework.Instance.GetPassportReaderList(); Desko.EPass.Framework.Instance.TerminalAuthenticationMode = Desko.EPass.Types.TerminalAuthenticationMode.LocalStorage; Desko.EPass.Framework.Instance.PassiveAuthenticationMode = Desko.EPass.Types.PassiveAuthenticationMode.LocalStorage; Desko.EPass.Types.TerminalType type = TerminalType.InspectionSystem; passport.Authenticate(Desko.EPass.Types.AuthenticationType.BAC, fullmrz, Desko.EPass.Types.SecretType.MRZ, true); //-->BAC // passport.PerformChipAuthentication(); passport.Authenticate(Desko.EPass.Types.AuthenticationType.PACE, fullmrz, Desko.EPass.Types.SecretType.MRZ, true);//-->SAC // passport.Authenticate(Desko.EPass.Types.AuthenticationType.PACE,Encoding.Default.GetString(, Desko.EPass.Types.SecretType.CAN);//-->SAC //Desko.EPass.Framework.Instance.TerminalAuthenticationMode = TerminalAuthenticationMode.LocalStorage; passport.PerformTerminalAuthentication(); }
private void button3_Click(object sender, EventArgs e) { try { Desko.EPass.Passport passport = Desko.EPass.Framework.Instance.GetPassport("DESKO GmbH SmartCard Reader 0", Desko.EPass.Types.ShareMode.Exclusive); passport.Initialize(Desko.EPass.Types.ShareMode.Shared); string fullmrz = mrzl[0] + mrzl[1]; string gercsca = @"C:\Users\hayreddin.bas\Documents\PASAPORT_SERTIFIKA_EGM_CALISMA\PROD\CSCAV1DER.cer"; string gercscacer = @"C:\Users\hayreddin.bas\Documents\PASAPORT_SERTIFIKA_EGM_CALISMA\PROD\CSCAV1.cer"; string gercscacrt = @"C:\Users\hayreddin.bas\Documents\PASAPORT_SERTIFIKA_EGM_CALISMA\PROD\CSCAV1DER.crt"; string oldcsca = @"C:\Users\hayreddin.bas\Desktop\tubitak toplantı\CSCA-2016\CSCA2016DER.cer"; string testyencsca = @"C:\Users\hayreddin.bas\Desktop\keys\pasaport sertifikaları\TEST\TESTCSCADER.cer"; string link = @"D:\dışişleri\Link.cer"; string bulg = @"C:\Users\hayreddin.bas\Downloads\bg_csca_16042014\bulg.cer"; string certson = @"C:\Users\hayreddin.bas\Desktop\RSA PROD\RSADERCSCA.cer"; string named = @"C:\Users\hayreddin.bas\Documents\muhammet-CSCALAR\csca - named.der"; string expl = @"C:\Users\hayreddin.bas\Documents\muhammet-CSCALAR\csca - explicit.der"; string CSCA_SON = @"C:\Users\hayreddin.bas\Desktop\keys\pasaport sertifikaları\PROD\CSCATR_S1.cer"; string Link_Son = @"C:\Users\hayreddin.bas\Desktop\keys\pasaport sertifikaları\PROD\CSCA-link-certificate2016-2018.crl"; string DVCA = @"C:\Users\hayreddin.bas\Documents\silnecekprod\TRDVCAEPASS.cvc"; string iscert = @"C:\Users\hayreddin.bas\Documents\yeni_is\16.cvc"; string is_key = @"C:\Users\hayreddin.bas\Documents\yeni_is\pk2.pkcs8"; Desko.EPass.Framework fr = new Desko.EPass.Framework(); fr.TerminalAuthenticationMode = Desko.EPass.Types.TerminalAuthenticationMode.LocalStorage; fr.PassiveAuthenticationMode = Desko.EPass.Types.PassiveAuthenticationMode.LocalStorage; // Desko.EPass.Framework.Instance.PassiveAuthenticationMode = Desko.EPass.Types.PassiveAuthenticationMode.LocalStorage; //Desko.EPass.Framework.Instance.TerminalAuthenticationMode = Desko.EPass.Types.TerminalAuthenticationMode.LocalStorage; //TerminalType type = new TerminalType(); //type = TerminalType.AuthenticationTerminal; //device.AbortLongTermOperation(); Desko.EPass.Certificates.Certificate CSCA_SONN = new Desko.EPass.Certificates.X509Certificate(StreamFile(gercsca)); //success Desko.EPass.Certificates.Certificate csca_expl = new Desko.EPass.Certificates.X509Certificate(StreamFile(expl)); //success Desko.EPass.Certificates.Certificate CSCA_named = new Desko.EPass.Certificates.X509Certificate(StreamFile(named)); //success Desko.EPass.Certificates.Certificate DVCA_cert = new Desko.EPass.Certificates.CvCertificate(StreamFile(DVCA)); Desko.EPass.Certificates.CvCertificate is_certf = new Desko.EPass.Certificates.CvCertificate(StreamFile(iscert)); Desko.EPass.CertificateStore.Instance.AddCertificate(CSCA_SONN); Desko.EPass.CertificateStore.Instance.AddCertificate(DVCA_cert); Desko.EPass.CertificateStore.Instance.AddCertificate(is_certf); byte[] pk1 = FileToByteArray(is_key); //Desko.EPass.Certificates.CvCertificate cert = new Desko.EPass.Certificates.CvCertificate(pk); // Desko.EPass.Certificates.CvCertificate cert1 = new Desko.EPass.Certificates.CvCertificate(pk1); // Desko.EPass.CertificateStore.Instance.AddCertificate(cert1); is_certf.SetCertificateKey(pk1); //successs Desko.EPass.CertificateStore.Instance.SaveCertificateDatabase("certdb1"); // Desko.EPass.CertificateStore.Instance.LoadCertificateDatabase("certdb1"); // byte[] pk = FileToByteArray(testcert4); //certificate1.GetChildCertificates(); // string pks = System.Text.Encoding.UTF8.GetString(pk); // text_mrz = "P<TURKARADEMIR<<APTI<<<<<<<<<<<<<<<<<<<<<<<<PL19827683TUR6306243M200214512345678901<<<00"; passport.Authenticate(Desko.EPass.Types.AuthenticationType.BAC, fullmrz, Desko.EPass.Types.SecretType.MRZ); //-->BAC // passport.PerformTerminalAuthentication(); passport.PerformChipAuthentication(); passport.Authenticate(Desko.EPass.Types.AuthenticationType.PACE, fullmrz, Desko.EPass.Types.SecretType.MRZ);//-->SAC label11.Text = passport.PassportInformation.AccessProtocol.ToString(); //45947186788 // passport.SetMaxAPDUSize(512); //////string aa = passport.PassportInformation.AccessProtocol.ToS0ö2tring();label26 //--------------------------BUARADA SUCCESS DÖNMESİ LAZIM------------------------- // MessageBox.Show(aa); // passport.PerformTerminalAuthentication(); // List<Desko.EPass.Certificates.RawCertificate> cers = new List<Desko.EPass.Certificates.RawCertificate>(); //cers.Add(new De); Desko.EPass.FileAuthenticationResults result = passport.CheckFileSignature(Desko.EPass.Types.FileType.SOD); MessageBox.Show(result.FileSignatureCheck.ToString()); //label15.Text ="Cert sign check="+ result.DocumenttSignerCertificateSignatureCheck.ToString(); label19.Text = "DOCUMENTSİGNERTRUESTSTATUS=" + result.DocumentSignerTrustStatus.ToString(); label20.Text = "COUNTRY SIGNER CERTIFICATE VALIDTY: " + result.CountrySignerCertificateValidity.ToString(); label21.Text = "DOCUMENT SIGNER CERT VALIDTY:" + result.DocumentSignerCertificateValidity.ToString(); label22.Text = "DOCUMENT SIGNER TRUST STAT:" + result.DocumentSignerTrustStatus.ToString(); label23.Text = "FILE SIGNATURE CHECK: " + result.FileSignatureCheck.ToString();; Desko.EPass.Certificates.RawCertificate certificate = passport.GetDocumentSignerCertificate(Desko.EPass.Types.FileType.SOD); File.WriteAllBytes("certDS2NewPROD", certificate.RawData); passport.Release(); } catch (Exception m) { MessageBox.Show(m.Message); } }