< prev index next >

src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/KeyStore.java

Print this page
rev 13119 : 8143913: MSCAPI keystore should accept Certificate[] in setEntry()

*** 387,408 **** entry = e; break; } } if (! found) { entry = //TODO new KeyEntry(alias, key, (X509Certificate[]) chain); ! new KeyEntry(alias, null, (X509Certificate[]) chain); entries.add(entry); } entry.setAlias(alias); try { entry.setPrivateKey((RSAPrivateCrtKey) key); ! entry.setCertificateChain((X509Certificate[]) chain); } catch (CertificateException ce) { throw new KeyStoreException(ce); } catch (InvalidKeyException ike) { --- 387,420 ---- entry = e; break; } } + X509Certificate[] xchain; + if (chain != null) { + if (chain instanceof X509Certificate[]) { + xchain = (X509Certificate[]) chain; + } else { + xchain = new X509Certificate[chain.length]; + System.arraycopy(chain, 0, xchain, 0, chain.length); + } + } else { + xchain = null; + } + if (! found) { entry = //TODO new KeyEntry(alias, key, (X509Certificate[]) chain); ! new KeyEntry(alias, null, xchain); entries.add(entry); } entry.setAlias(alias); try { entry.setPrivateKey((RSAPrivateCrtKey) key); ! entry.setCertificateChain(xchain); } catch (CertificateException ce) { throw new KeyStoreException(ce); } catch (InvalidKeyException ike) {
< prev index next >