src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1999, 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1999, 2015, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 1640,1666 ****
String alias = e.nextElement();
Entry entry = entries.get(alias);
// certificate chain
! int chainLen = 1;
! Certificate[] certs = null;
if (entry instanceof PrivateKeyEntry) {
PrivateKeyEntry keyEntry = (PrivateKeyEntry) entry;
! if (keyEntry.chain == null) {
! chainLen = 0;
} else {
! chainLen = keyEntry.chain.length;
}
- certs = keyEntry.chain;
-
} else if (entry instanceof CertEntry) {
certs = new Certificate[]{((CertEntry) entry).cert};
}
! for (int i = 0; i < chainLen; i++) {
// create SafeBag of Type CertBag
DerOutputStream safeBag = new DerOutputStream();
safeBag.putOID(CertBag_OID);
// create a CertBag
--- 1640,1665 ----
String alias = e.nextElement();
Entry entry = entries.get(alias);
// certificate chain
! Certificate[] certs;
if (entry instanceof PrivateKeyEntry) {
PrivateKeyEntry keyEntry = (PrivateKeyEntry) entry;
! if (keyEntry.chain != null) {
! certs = keyEntry.chain;
} else {
! certs = new Certificate[0];
}
} else if (entry instanceof CertEntry) {
certs = new Certificate[]{((CertEntry) entry).cert};
+ } else {
+ certs = new Certificate[0];
}
! for (int i = 0; i < certs.length; i++) {
// create SafeBag of Type CertBag
DerOutputStream safeBag = new DerOutputStream();
safeBag.putOID(CertBag_OID);
// create a CertBag