public GetCertificate ( ) : |
||
리턴 |
public virtual bool Check(CertificateAndContext cert) { //TODO jbonilla - Validar //byte[] qcStatement = cert.GetCertificate().GetExtensionValue(X509Extensions.QCStatements); Asn1OctetString qcStatement = cert.GetCertificate().GetExtensionValue(X509Extensions.QCStatements); if (qcStatement != null) { try { //Asn1InputStream input = new Asn1InputStream(qcStatement); //DerOctetString s = (DerOctetString)input.ReadObject(); DerOctetString s = (DerOctetString)qcStatement; byte[] content = s.GetOctets(); Asn1InputStream input = new Asn1InputStream(content); DerSequence seq = (DerSequence)input.ReadObject(); for (int i = 0; i < seq.Count; i++) { QCStatement statement = QCStatement.GetInstance(seq[i]); if (statement.StatementId.Id.Equals(qcStatementId)) { return true; } } return false; } catch (IOException e) { throw new RuntimeException(e); } } return false; }
/// <summary>The default constructor for CertificateVerification.</summary> /// <remarks>The default constructor for CertificateVerification.</remarks> /// <param name="cert"></param> /// <param name="ctx"></param> public CertificateVerification(CertificateAndContext cert, ValidationContext ctx) { certificate = cert; if (cert != null) { try { cert.GetCertificate().CheckValidity(ctx.GetValidationDate()); validityPeriodVerification = new Result(Result.ResultStatus.VALID, null); } catch (CertificateExpiredException) { validityPeriodVerification = new Result(Result.ResultStatus.INVALID, "certificate.expired" ); } catch (CertificateNotYetValidException) { validityPeriodVerification = new Result(Result.ResultStatus.INVALID, "certificate.not.yet.valid" ); } CertificateStatus status = ctx.GetCertificateStatusFromContext(cert); if (status != null) { certificateStatus = new RevocationVerificationResult(status); } } }
public virtual bool Check(CertificateAndContext cert) { //TODO jbonilla - validar. //byte[] certificatePolicies = cert.GetCertificate().GetExtensionValue(X509Extensions.CertificatePolicies); Asn1OctetString certificatePolicies = cert.GetCertificate().GetExtensionValue(X509Extensions.CertificatePolicies); if (certificatePolicies != null) { try { //Asn1InputStream input = new Asn1InputStream(certificatePolicies); //DerOctetString s = (DerOctetString)input.ReadObject(); DerOctetString s = (DerOctetString)certificatePolicies; byte[] content = s.GetOctets(); Asn1InputStream input = new Asn1InputStream(content); DerSequence seq = (DerSequence)input.ReadObject(); for (int i = 0; i < seq.Count; i++) { PolicyInformation policyInfo = PolicyInformation.GetInstance(seq[i]); if (policyInfo.PolicyIdentifier.Id.Equals(policyOid)) { return true; } } } catch (IOException e) { throw new RuntimeException(e); } } return false; }
public virtual bool Check(CertificateAndContext cert) { return cert.GetCertificate().GetKeyUsage()[(int)bit]; }