private Attribute MakeSigningCertificateAttribute(SignatureParameters parameters) { try { byte[] certHash = DigestUtilities.CalculateDigest (parameters.DigestAlgorithm.GetName(), parameters.SigningCertificate.GetEncoded()); if (parameters.DigestAlgorithm == DigestAlgorithm.SHA1) { SigningCertificate sc = new SigningCertificate(new EssCertID(certHash)); return new Attribute(PkcsObjectIdentifiers.IdAASigningCertificate, new DerSet(sc )); } else { EssCertIDv2 essCert = new EssCertIDv2(new AlgorithmIdentifier(parameters.DigestAlgorithm .GetOid()), certHash); SigningCertificateV2 scv2 = new SigningCertificateV2(new EssCertIDv2[] { essCert } ); return new Attribute(PkcsObjectIdentifiers.IdAASigningCertificateV2, new DerSet (scv2)); } } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } catch (CertificateException e) { throw new RuntimeException(e); } }
public EssCertIDv2[] GetCerts() { EssCertIDv2[] certIds = new EssCertIDv2[certs.Count]; for (int i = 0; i != certs.Count; i++) { certIds[i] = EssCertIDv2.GetInstance(certs[i]); } return certIds; }
public override void PerformTest() { // check GetInstance on default algorithm. byte[] digest = new byte[32]; EssCertIDv2 essCertIdv2 = new EssCertIDv2( new AlgorithmIdentifier(NistObjectIdentifiers.IdSha256), digest); Asn1Object asn1Object = essCertIdv2.ToAsn1Object(); EssCertIDv2.GetInstance(asn1Object); }
public SigningCertificateV2( EssCertIDv2[] certs, PolicyInformation[] policies) { this.certs = new DerSequence(certs); if (policies != null) { this.policies = new DerSequence(policies); } }
internal CertID(EssCertIDv2 certID) { this.certIDv2 = certID; this.certID = null; }
public SigningCertificateV2( EssCertIDv2[] certs) { this.certs = new DerSequence(certs); }