Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1533216 - check we actually got some certs in collect_certs r=jcj
Test Plan: https://treeherder.mozilla.org/#/jobs?repo=nss-try&revision=1b44b7588cb9a6806701394c08bf64d13f84b982 Reviewers: jcj Reviewed By: jcj Bug #: 1533216 Differential Revision: https://phabricator.services.mozilla.com/D23752 --HG-- extra : rebase_source : 85b6afa770ee9085482322add6b6747aa5fc9016 extra : histedit_source : 3a11df58e7238bfd0d75a82b807cdf7e351cefb6
- Loading branch information
Showing
4 changed files
with
41 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | ||
/* vim: set ts=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/. */ | ||
|
||
#include "gtest/gtest.h" | ||
|
||
#include "cert.h" | ||
#include "prerror.h" | ||
#include "secerr.h" | ||
|
||
class DecodeCertsTest : public ::testing::Test {}; | ||
|
||
TEST_F(DecodeCertsTest, EmptyCertPackage) { | ||
// This represents a PKCS#7 ContentInfo with a contentType of | ||
// '2.16.840.1.113730.2.5' (Netscape data-type cert-sequence) and a content | ||
// consisting of an empty SEQUENCE. This is valid ASN.1, but it contains no | ||
// certificates, so CERT_DecodeCertFromPackage should just return a null | ||
// pointer. | ||
unsigned char emptyCertPackage[] = {0x30, 0x0f, 0x06, 0x09, 0x60, 0x86, | ||
0x48, 0x01, 0x86, 0xf8, 0x42, 0x02, | ||
0x05, 0xa0, 0x02, 0x30, 0x00}; | ||
EXPECT_EQ(nullptr, CERT_DecodeCertFromPackage( | ||
reinterpret_cast<char*>(emptyCertPackage), | ||
sizeof(emptyCertPackage))); | ||
EXPECT_EQ(SEC_ERROR_BAD_DER, PR_GetError()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters