/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// we don't use the certificate for path building, so this parameter doesn't // matter
EndEntityOrCA notUsedForPaths = EndEntityOrCA::MustBeEndEntity;
BackCert cert(certInput, notUsedForPaths, nullptr);
rv = cert.Init(); if (rv != Success) { returnfalse;
}
Input subject(cert.GetSubject());
for (auto& dn : aDnList) {
Input dnInput;
rv = dnInput.Init(dn.data, dn.len); if (rv != Success) { returnfalse;
}
if (InputsAreEqual(subject, dnInput)) { returntrue;
}
} returnfalse;
}
template <size_t T> staticbool CertSPKIIsInList(Input aCertInput, const DataAndLength (&aSpkiList)[T]) { // we don't use the certificate for path building, so this parameter doesn't // matter
EndEntityOrCA notUsedForPaths = EndEntityOrCA::MustBeEndEntity;
BackCert cert(aCertInput, notUsedForPaths, nullptr);
mozilla::pkix::Result rv = cert.Init(); if (rv != Success) { returnfalse;
}
Input publicKey(cert.GetSubjectPublicKeyInfo());
for (auto& spki : aSpkiList) {
Input spkiInput;
rv = spkiInput.Init(spki.data, spki.len); if (rv != Success) { returnfalse;
}
if (InputsAreEqual(publicKey, spkiInput)) { returntrue;
}
} returnfalse;
}
// we don't use the certificate for path building, so this parameter doesn't // matter
EndEntityOrCA notUsedForPaths = EndEntityOrCA::MustBeEndEntity;
BackCert cert(certInput, notUsedForPaths, nullptr);
rv = cert.Init(); if (rv != Success) { returnfalse;
}
// Implements the graduated Symantec distrust algorithm from Bug 1409257. // This accepts a pre-segmented certificate chain (e.g. SegmentCertificateChain) // as |intCerts|, and pre-assumes that the root has been identified // as being affected (this is to avoid duplicate Segment operations in the // NSSCertDBTrustDomain). Each of the |intCerts| is evaluated against a // |allowlist| of SPKI entries, and if a match is found, then this returns // "not distrusted." Otherwise, due to the precondition holding, the chain is // "distrusted." template <size_t T> static nsresult CheckForSymantecDistrust(const nsTArray<Input>& intCerts, const DataAndLength (&allowlist)[T], /* out */ bool& isDistrusted) { // PRECONDITION: The rootCert is already verified as being one of the // affected Symantec roots
isDistrusted = true;
for (constauto& cert : intCerts) { if (CertSPKIIsInList(cert, allowlist)) {
isDistrusted = false; break;
}
} return NS_OK;
}
#endif// TrustOverrides_h
¤ Dauer der Verarbeitung: 0.17 Sekunden
(vorverarbeitet)
¤
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 ist noch experimentell.