public CrlOcspRef[] GetCrlOcspRefs() { CrlOcspRef[] array = new CrlOcspRef[crlOcspRefs.Count]; for (int i = 0; i < crlOcspRefs.Count; i++) { array[i] = CrlOcspRef.GetInstance(crlOcspRefs[i].ToAsn1Object()); } return(array); }
private CompleteRevocationRefs(Asn1Sequence seq) { if (seq == null) { throw new ArgumentNullException("seq"); } foreach (Asn1Encodable item in seq) { CrlOcspRef.GetInstance(item.ToAsn1Object()); } crlOcspRefs = seq; }
public virtual IList <OCSPRef> GetOCSPRefs() { IList <OCSPRef> list = new List <OCSPRef>(); if (signerInformation.UnsignedAttributes != null) { BcCms.Attribute completeRevocationRefsAttr = signerInformation.UnsignedAttributes [PkcsObjectIdentifiers.IdAAEtsRevocationRefs]; if (completeRevocationRefsAttr != null && completeRevocationRefsAttr.AttrValues .Count > 0) { DerSequence completeRevocationRefs = (DerSequence)completeRevocationRefsAttr.AttrValues[0]; for (int i1 = 0; i1 < completeRevocationRefs.Count; i1++) { CrlOcspRef otherCertId = CrlOcspRef.GetInstance(completeRevocationRefs[i1]); foreach (OcspResponsesID id in otherCertId.OcspIDs.GetOcspResponses()) { list.Add(new OCSPRef(id, true)); } } } } return(list); }
public virtual IList <CRLRef> GetCRLRefs() { IList <CRLRef> list = new AList <CRLRef>(); if (signerInformation.UnsignedAttributes != null) { BcCms.Attribute completeRevocationRefsAttr = signerInformation.UnsignedAttributes [PkcsObjectIdentifiers.IdAAEtsRevocationRefs]; if (completeRevocationRefsAttr != null && completeRevocationRefsAttr.AttrValues .Count > 0) { DerSequence completeCertificateRefs = (DerSequence)completeRevocationRefsAttr.AttrValues[0]; for (int i1 = 0; i1 < completeCertificateRefs.Count; i1++) { CrlOcspRef otherCertId = CrlOcspRef.GetInstance(completeCertificateRefs[i1]); foreach (CrlValidatedID id in otherCertId.CrlIDs.GetCrls()) { list.AddItem(new CRLRef(id)); } } } } return(list); }
/// <exception cref="System.IO.IOException"></exception> //private IDictionary<DerObjectIdentifier, Asn1Encodable> ExtendUnsignedAttributes(IDictionary // <DerObjectIdentifier, Asn1Encodable> unsignedAttrs, X509Certificate signingCertificate // , SignatureParameters parameters, DateTime signingTime, CertificateSource optionalCertificateSource // ) private IDictionary ExtendUnsignedAttributes(IDictionary unsignedAttrs, X509Certificate signingCertificate , SignatureParameters parameters, DateTime signingTime, CertificateSource optionalCertificateSource ) { ValidationContext validationContext = certificateVerifier.ValidateCertificate(signingCertificate , signingTime, new CompositeCertificateSource(new ListCertificateSource(parameters .CertificateChain), optionalCertificateSource), null, null); try { AList <OtherCertID> completeCertificateRefs = new AList <OtherCertID>(); AList <CrlOcspRef> completeRevocationRefs = new AList <CrlOcspRef>(); foreach (CertificateAndContext c in validationContext.GetNeededCertificates()) { if (!c.Equals(signingCertificate)) { completeCertificateRefs.AddItem(MakeOtherCertID(c.GetCertificate())); } // certificateValues.add(new X509CertificateStructure((Asn1Sequence) Asn1Object.fromByteArray(c // .getCertificate().getEncoded()))); AList <CrlValidatedID> crlListIdValues = new AList <CrlValidatedID>(); AList <OcspResponsesID> ocspListIDValues = new AList <OcspResponsesID>(); foreach (X509Crl relatedcrl in validationContext.GetRelatedCRLs(c)) { crlListIdValues.AddItem(MakeCrlValidatedID((X509Crl)relatedcrl)); } foreach (BasicOcspResp relatedocspresp in validationContext.GetRelatedOCSPResp(c)) { ocspListIDValues.AddItem(MakeOcspResponsesID(relatedocspresp)); } CrlValidatedID[] crlListIdArray = new CrlValidatedID[crlListIdValues.Count]; OcspResponsesID[] ocspListIDArray = new OcspResponsesID[ocspListIDValues.Count]; completeRevocationRefs.AddItem(new CrlOcspRef(new CrlListID(Sharpen.Collections.ToArray (crlListIdValues, crlListIdArray)), new OcspListID(Sharpen.Collections.ToArray(ocspListIDValues , ocspListIDArray)), null)); } OtherCertID[] otherCertIDArray = new OtherCertID[completeCertificateRefs.Count]; CrlOcspRef[] crlOcspRefArray = new CrlOcspRef[completeRevocationRefs.Count]; //unsignedAttrs.Put(PkcsObjectIdentifiers.IdAAEtsCertificateRefs, new Attribute( unsignedAttrs.Add(PkcsObjectIdentifiers.IdAAEtsCertificateRefs, new BcCms.Attribute( PkcsObjectIdentifiers.IdAAEtsCertificateRefs, new DerSet(new DerSequence(Sharpen.Collections.ToArray (completeCertificateRefs, otherCertIDArray))))); //unsignedAttrs.Put(PkcsObjectIdentifiers.IdAAEtsRevocationRefs, new Attribute(PkcsObjectIdentifiers.IdAAEtsRevocationRefs, new DerSet(new DerSequence(Sharpen.Collections.ToArray unsignedAttrs.Add(PkcsObjectIdentifiers.IdAAEtsRevocationRefs, new BcCms.Attribute(PkcsObjectIdentifiers.IdAAEtsRevocationRefs, new DerSet(new DerSequence(Sharpen.Collections.ToArray (completeRevocationRefs, crlOcspRefArray))))); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } catch (CertificateEncodingException e) { throw new RuntimeException(e); } catch (OcspException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } catch (CrlException e) { throw new RuntimeException(e); } return(unsignedAttrs); }