Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
8254081: java/security/cert/PolicyNode/GetPolicyQualifiers.java fails…
Browse files Browse the repository at this point in the history
… due to an expired certificate

Perform backdated validation of test certificate.

Backport-of: 54b340b
  • Loading branch information
Yuri Nesterenko committed Dec 10, 2020
1 parent 7ccba65 commit 7a2731e
Showing 1 changed file with 6 additions and 1 deletion.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -30,9 +30,11 @@
import java.io.File;
import java.io.FileInputStream;
import java.security.cert.*;
import java.text.DateFormat;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Set;

public class GetPolicyQualifiers {
Expand All @@ -52,6 +54,9 @@ public static void main(String[] args) throws Exception {
PKIXParameters params = new PKIXParameters(trustAnchors);
params.setPolicyQualifiersRejected(false);
params.setRevocationEnabled(false);
// Certificates expired on Oct 6th, 2020
params.setDate(DateFormat.getDateInstance(DateFormat.MEDIUM,
Locale.US).parse("July 01, 2020"));
List certList = Collections.singletonList(eeCert);
CertPath cp = cf.generateCertPath(certList);
PKIXCertPathValidatorResult result =
Expand Down

1 comment on commit 7a2731e

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.