changeset 1515:7ab5e1b09299

6923681: Jarsigner crashes during timestamping Reviewed-by: vinnie
author weijun
date Mon, 05 Dec 2016 04:15:08 +0000
parents 3f4458651202
children a46afd6fb2d3
files src/share/classes/sun/security/tools/jarsigner/TimestampedSigner.java
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/security/tools/jarsigner/TimestampedSigner.java	Mon Dec 05 04:10:41 2016 +0000
+++ b/src/share/classes/sun/security/tools/jarsigner/TimestampedSigner.java	Mon Dec 05 04:15:08 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2010, 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
@@ -376,7 +376,8 @@
                 }
                 if (!isSigner) {
                     keyPurposes = cert.getExtendedKeyUsage();
-                    if (! keyPurposes.contains(KP_TIMESTAMPING_OID)) {
+                    if (keyPurposes == null ||
+                            ! keyPurposes.contains(KP_TIMESTAMPING_OID)) {
                         throw new CertificateException(
                             "Certificate is not valid for timestamping");
                     }