예제 #1
0
        /// <summary>Create a reference to a X509Crl</summary>
        /// <param name="crl"></param>
        /// <returns></returns>
        /// <exception cref="Sharpen.NoSuchAlgorithmException">Sharpen.NoSuchAlgorithmException
        ///     </exception>
        /// <exception cref="Sharpen.CrlException">Sharpen.CrlException</exception>
        private CrlValidatedID MakeCrlValidatedID(X509Crl crl)
        {
            OtherHash hash = new OtherHash(DigestUtilities.CalculateDigest
                                               (X509ObjectIdentifiers.IdSha1, crl.GetEncoded()));
            BigInteger          crlnumber;
            CrlIdentifier       crlid;
            DerObjectIdentifier crlExt = new DerObjectIdentifier("2.5.29.20");

            if (crl.GetExtensionValue(crlExt) != null)
            {
                //crlnumber = new DerInteger(crl.GetExtensionValue(crlExt)).GetPositiveValue();
                crlnumber = new DerInteger(crl.GetExtensionValue(crlExt).GetDerEncoded()).PositiveValue;
                //crlid = new CrlIdentifier(new X509Name(crl.IssuerDN.GetName()), new
                crlid = new CrlIdentifier(crl.IssuerDN,
                                          //new DerUtcTime(crl.ThisUpdate), crlnumber);
                                          crl.ThisUpdate, crlnumber);
            }
            else
            {
                //crlid = new CrlIdentifier(new X509Name(crl.IssuerDN.GetName()),
                crlid = new CrlIdentifier(crl.IssuerDN,
                                          //new DerUtcTime(crl.ThisUpdate));
                                          crl.ThisUpdate);
            }
            CrlValidatedID crlvid = new CrlValidatedID(hash, crlid);

            return(crlvid);
        }
 public CrlValidatedID(OtherHash crlHash, CrlIdentifier crlIdentifier)
 {
     if (crlHash == null)
     {
         throw new ArgumentNullException("crlHash");
     }
     this.crlHash       = crlHash;
     this.crlIdentifier = crlIdentifier;
 }
 private CrlValidatedID(Asn1Sequence seq)
 {
     if (seq == null)
     {
         throw new ArgumentNullException("seq");
     }
     if (seq.Count < 1 || seq.Count > 2)
     {
         throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
     }
     crlHash = OtherHash.GetInstance(seq[0].ToAsn1Object());
     if (seq.Count > 1)
     {
         crlIdentifier = CrlIdentifier.GetInstance(seq[1].ToAsn1Object());
     }
 }