mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
f672f60d2d
- Bug 1135100 - Don't update GC thing pointers that haven't changed after marking r=terrence (0df3ea820) - Bug 1135857 - Remove ContentClientIncremental. r=mattwoodrow (059587352) - Bug 1135809 - add apz. prefs to about:support. r=kats (6439aaf6b) - Bug 1135361 - Fix position of ruby annotation in vertical-rl mode when justification is applied to the base. r=jfkthame (a00bb53be) - Bug 1133288 - Remove nonstandard expression closures from editor. r=ehsan (605992184) - Bug 1135361 - Reftest for ruby positioning in justified vertical text. r=xidorn (60fe87ae3) - Bug 1135984 - Fix typo which made Context.__init__ set the unused exe (312c35ef2) - Bug 1077864, Part 1: Check consistency of certificates' signature and signatureAlgorithm fields, r=keeler (9a11f90c3) - Bug 1077864, Part 2: Override the trust level for OCSP response signer certs so that they are never considered trust anchors, r=keeler (c46772e6d) - Bug 1077864, Part 3: update nsserrors.properties so error message gets localized. (935233549) - Bug 1135407: Factor out duplicate logic in tests, r=keeler (383ff80c5) - Bug 1131767: Prune away paths using unacceptable algorithms earlier, r=keeler (55182b7e2) - Followup to Bug 1135563 - uiUnsupportedAlreadyNotified.js doesn't use httpd.js. r=me (cef9dbdcd) - Bug 1135563 - Fix several javascript warnings for xpcshell app update tests and cleanup style. r=spohl (6330eb78c) - Bug 1123019 - In DrawTargetTiled::StrokeRect and StrokeLine, skip tiles that don't intersect the stroke. r=jrmuizel (71afc7653) - Bug 1123019 - Shrink clipped stroked rectangles and stroked lines. r=jrmuizel (17e93d70f) - Bug 1123019 - Actually use the clipped rect variable. r=jrmuizel (29c96ab43)
157 lines
4.7 KiB
C++
157 lines
4.7 KiB
C++
/* -*- 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 code is made available to you under your choice of the following sets
|
|
* of licensing terms:
|
|
*/
|
|
/* 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/.
|
|
*/
|
|
/* Copyright 2014 Mozilla Contributors
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
#include "pkixgtest.h"
|
|
|
|
using namespace mozilla::pkix;
|
|
using namespace mozilla::pkix::test;
|
|
|
|
namespace mozilla { namespace pkix {
|
|
|
|
Result CheckValidity(const Input encodedValidity, Time time);
|
|
|
|
} } // namespace mozilla::pkix
|
|
|
|
static const Time PAST_TIME(YMDHMS(1998, 12, 31, 12, 23, 56));
|
|
|
|
#define OLDER_GENERALIZEDTIME \
|
|
0x18, 15, /* tag, length */ \
|
|
'1', '9', '9', '9', '0', '1', '0', '1', /* 1999-01-01 */ \
|
|
'0', '0', '0', '0', '0', '0', 'Z' /* 00:00:00Z */
|
|
|
|
#define OLDER_UTCTIME \
|
|
0x17, 13, /* tag, length */ \
|
|
'9', '9', '0', '1', '0', '1', /* (19)99-01-01 */ \
|
|
'0', '0', '0', '0', '0', '0', 'Z' /* 00:00:00Z */
|
|
|
|
static const Time NOW(YMDHMS(2016, 12, 31, 12, 23, 56));
|
|
|
|
#define NEWER_GENERALIZEDTIME \
|
|
0x18, 15, /* tag, length */ \
|
|
'2', '0', '2', '1', '0', '1', '0', '1', /* 2021-01-01 */ \
|
|
'0', '0', '0', '0', '0', '0', 'Z' /* 00:00:00Z */
|
|
|
|
#define NEWER_UTCTIME \
|
|
0x17, 13, /* tag, length */ \
|
|
'2', '1', '0', '1', '0', '1', /* 2021-01-01 */ \
|
|
'0', '0', '0', '0', '0', '0', 'Z' /* 00:00:00Z */
|
|
|
|
static const Time FUTURE_TIME(YMDHMS(2025, 12, 31, 12, 23, 56));
|
|
|
|
class pkixcheck_CheckValidity : public ::testing::Test { };
|
|
|
|
TEST_F(pkixcheck_CheckValidity, BothEmptyNull)
|
|
{
|
|
static const uint8_t DER[] = {
|
|
0x17/*UTCTime*/, 0/*length*/,
|
|
0x17/*UTCTime*/, 0/*length*/,
|
|
};
|
|
static const Input validity(DER);
|
|
ASSERT_EQ(Result::ERROR_INVALID_DER_TIME, CheckValidity(validity, NOW));
|
|
}
|
|
|
|
TEST_F(pkixcheck_CheckValidity, NotBeforeEmptyNull)
|
|
{
|
|
static const uint8_t DER[] = {
|
|
0x17/*UTCTime*/, 0x00/*length*/,
|
|
NEWER_UTCTIME
|
|
};
|
|
static const Input validity(DER);
|
|
ASSERT_EQ(Result::ERROR_INVALID_DER_TIME, CheckValidity(validity, NOW));
|
|
}
|
|
|
|
TEST_F(pkixcheck_CheckValidity, NotAfterEmptyNull)
|
|
{
|
|
static const uint8_t DER[] = {
|
|
NEWER_UTCTIME,
|
|
0x17/*UTCTime*/, 0x00/*length*/,
|
|
};
|
|
static const Input validity(DER);
|
|
ASSERT_EQ(Result::ERROR_INVALID_DER_TIME, CheckValidity(validity, NOW));
|
|
}
|
|
|
|
static const uint8_t OLDER_UTCTIME_NEWER_UTCTIME_DATA[] = {
|
|
OLDER_UTCTIME,
|
|
NEWER_UTCTIME,
|
|
};
|
|
static const Input
|
|
OLDER_UTCTIME_NEWER_UTCTIME(OLDER_UTCTIME_NEWER_UTCTIME_DATA);
|
|
|
|
TEST_F(pkixcheck_CheckValidity, Valid_UTCTIME_UTCTIME)
|
|
{
|
|
ASSERT_EQ(Success, CheckValidity(OLDER_UTCTIME_NEWER_UTCTIME, NOW));
|
|
}
|
|
|
|
TEST_F(pkixcheck_CheckValidity, Valid_GENERALIZEDTIME_GENERALIZEDTIME)
|
|
{
|
|
static const uint8_t DER[] = {
|
|
OLDER_GENERALIZEDTIME,
|
|
NEWER_GENERALIZEDTIME,
|
|
};
|
|
static const Input validity(DER);
|
|
ASSERT_EQ(Success, CheckValidity(validity, NOW));
|
|
}
|
|
|
|
TEST_F(pkixcheck_CheckValidity, Valid_GENERALIZEDTIME_UTCTIME)
|
|
{
|
|
static const uint8_t DER[] = {
|
|
OLDER_GENERALIZEDTIME,
|
|
NEWER_UTCTIME,
|
|
};
|
|
static const Input validity(DER);
|
|
ASSERT_EQ(Success, CheckValidity(validity, NOW));
|
|
}
|
|
|
|
TEST_F(pkixcheck_CheckValidity, Valid_UTCTIME_GENERALIZEDTIME)
|
|
{
|
|
static const uint8_t DER[] = {
|
|
OLDER_UTCTIME,
|
|
NEWER_GENERALIZEDTIME,
|
|
};
|
|
static const Input validity(DER);
|
|
ASSERT_EQ(Success, CheckValidity(validity, NOW));
|
|
}
|
|
|
|
TEST_F(pkixcheck_CheckValidity, InvalidBeforeNotBefore)
|
|
{
|
|
ASSERT_EQ(Result::ERROR_NOT_YET_VALID_CERTIFICATE,
|
|
CheckValidity(OLDER_UTCTIME_NEWER_UTCTIME, PAST_TIME));
|
|
}
|
|
|
|
TEST_F(pkixcheck_CheckValidity, InvalidAfterNotAfter)
|
|
{
|
|
ASSERT_EQ(Result::ERROR_EXPIRED_CERTIFICATE,
|
|
CheckValidity(OLDER_UTCTIME_NEWER_UTCTIME, FUTURE_TIME));
|
|
}
|
|
|
|
TEST_F(pkixcheck_CheckValidity, InvalidNotAfterBeforeNotBefore)
|
|
{
|
|
static const uint8_t DER[] = {
|
|
NEWER_UTCTIME,
|
|
OLDER_UTCTIME,
|
|
};
|
|
static const Input validity(DER);
|
|
ASSERT_EQ(Result::ERROR_INVALID_DER_TIME, CheckValidity(validity, NOW));
|
|
}
|