equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
89 UnrecoverableKeyException { |
89 UnrecoverableKeyException { |
90 if (ks == null) { |
90 if (ks == null) { |
91 keyManager = new X509KeyManagerImpl( |
91 keyManager = new X509KeyManagerImpl( |
92 Collections.<Builder>emptyList()); |
92 Collections.<Builder>emptyList()); |
93 } else { |
93 } else { |
94 if (SunJSSE.isFIPS() && (ks.getProvider() != SunJSSE.cryptoProvider)) { |
94 if (SunJSSE.isFIPS() && |
95 throw new KeyStoreException("FIPS mode: KeyStore must be " |
95 (ks.getProvider() != SunJSSE.cryptoProvider)) { |
96 + "from provider " + SunJSSE.cryptoProvider.getName()); |
96 throw new KeyStoreException( |
|
97 "FIPS mode: KeyStore must be " + |
|
98 "from provider " + SunJSSE.cryptoProvider.getName()); |
97 } |
99 } |
98 try { |
100 try { |
99 Builder builder = Builder.newInstance(ks, |
101 Builder builder = Builder.newInstance(ks, |
100 new PasswordProtection(password)); |
102 new PasswordProtection(password)); |
101 keyManager = new X509KeyManagerImpl(builder); |
103 keyManager = new X509KeyManagerImpl(builder); |
112 if (params instanceof KeyStoreBuilderParameters == false) { |
114 if (params instanceof KeyStoreBuilderParameters == false) { |
113 throw new InvalidAlgorithmParameterException( |
115 throw new InvalidAlgorithmParameterException( |
114 "Parameters must be instance of KeyStoreBuilderParameters"); |
116 "Parameters must be instance of KeyStoreBuilderParameters"); |
115 } |
117 } |
116 if (SunJSSE.isFIPS()) { |
118 if (SunJSSE.isFIPS()) { |
117 // XXX should be fixed |
|
118 throw new InvalidAlgorithmParameterException |
119 throw new InvalidAlgorithmParameterException |
119 ("FIPS mode: KeyStoreBuilderParameters not supported"); |
120 ("FIPS mode: KeyStoreBuilderParameters not supported"); |
120 } |
121 } |
121 List<Builder> builders = |
122 List<Builder> builders = |
122 ((KeyStoreBuilderParameters)params).getParameters(); |
123 ((KeyStoreBuilderParameters)params).getParameters(); |