/* * Copyright 2004 The WebRTC Project Authors. All rights reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree.
*/
std::unique_ptr<SSLCertificateStats> SSLCertificate::GetStats() const { // TODO(bemasc): Move this computation to a helper class that caches these // values to reduce CPU use in `StatsCollector::GetStats`. This will require // adding a fast `SSLCertificate::Equals` to detect certificate changes.
std::string digest_algorithm; if (!GetSignatureDigestAlgorithm(&digest_algorithm)) return nullptr;
// `SSLFingerprint::Create` can fail if the algorithm returned by // `SSLCertificate::GetSignatureDigestAlgorithm` is not supported by the // implementation of `SSLCertificate::ComputeDigest`. This currently happens // with MD5- and SHA-224-signed certificates when linked to libNSS.
std::unique_ptr<SSLFingerprint> ssl_fingerprint =
SSLFingerprint::Create(digest_algorithm, *this); if (!ssl_fingerprint) return nullptr;
std::string fingerprint = ssl_fingerprint->GetRfc4572Fingerprint();
std::unique_ptr<SSLCertificateStats> SSLCertChain::GetStats() const { // We have a linked list of certificates, starting with the first element of // `certs_` and ending with the last element of `certs_`. The "issuer" of a // certificate is the next certificate in the chain. Stats are produced for // each certificate in the list. Here, the "issuer" is the issuer's stats.
std::unique_ptr<SSLCertificateStats> issuer; // The loop runs in reverse so that the `issuer` is known before the // certificate issued by `issuer`. for (ptrdiff_t i = certs_.size() - 1; i >= 0; --i) {
std::unique_ptr<SSLCertificateStats> new_stats = certs_[i]->GetStats(); if (new_stats) {
new_stats->issuer = std::move(issuer);
}
issuer = std::move(new_stats);
} return issuer;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.