Exemple #1
0
 public static void SetSODCAs(PTEID_Certif[] pteidcs){
     if (readerContext != null) {
         try {
             foreach (PTEID_Certif pcert in  pteidcs) {
                 PTEID_ByteArray pba = new PTEID_ByteArray(pcert.certif, (uint)pcert.certif.Length);
                 readerContext.getEIDCard().getCertificates().addCertificate(pba);
             }
         } catch (Exception ex) {
             throw new PteidException(0);
         }
     }
 }
Exemple #2
0
    public static PTEID_Certif[] GetCertificates(){
        PTEID_Certif[] certs = null;
        PTEID_ByteArray ba = new PTEID_ByteArray();
        
        try {
            PTEID_Certificates certificates = idCard.getCertificates();
            certs = new PTEID_Certif[(int)certificates.countAll()];
            for(uint i=0;i<certs.Length;i++){
                certs[i] = new PTEID_Certif();
                certificates.getCert(i).getFormattedData(ba);
                certs[i].certif = new byte[(int)(ba.Size())];
                Array.Copy(ba.GetBytes(), 0, certs[i].certif, 0, (int)ba.Size());
                certs[i].certifLabel = certificates.getCert(i).getLabel();
            }
        } catch (Exception ex) {
            throw new PteidException(0);
        }

        return certs;
    }