/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test 1.5, 03/06/24
* @bug 4850376
* @summary Provide generic storage KeyStore storage facilities
*/
public class EntryMethods
extends Provider
{
return null;
}
}
super("EntryMethods", 0.0, "EntryMethods");
pre15fis = new FileInputStream
put("KeyStore.UnrecoverableKeyStore",
"EntryMethods$UnrecoverableKS");
return null;
}
});
}
// test pre-JDK1.5 KeyStore throws UnsupportedOperationExceptions
// for new methods
// test post-JDK1.5 KeyStore does right thing with new methods
// test post-JDK1.5 KeyStore can throw new UnrecoverableEntryException
}
int tNum = 1;
// TEST load null param
// TEST load random param
try {
} catch (UnsupportedOperationException uoe) {
}
// TEST store random param
// setup for later user
try {
} catch (UnsupportedOperationException uoe) {
// good
}
// TEST store null param
try {
} catch (UnsupportedOperationException uoe) {
// good
}
if (e == null) {
} else {
"expected null entry returned");
}
try {
"expected UnrecoverableEntryException");
} catch (UnrecoverableEntryException uee) {
}
try {
"expected UnrecoverableEntryException");
} catch (UnrecoverableEntryException uee) {
}
try {
"expected UnsupportedOperationException");
} catch (UnsupportedOperationException uoe) {
}
if (e instanceof KeyStore.PrivateKeyEntry) {
} else {
"expected PrivateKeyEntry");
}
if (e instanceof KeyStore.TrustedCertificateEntry) {
} else {
}
try {
} catch (UnsupportedOperationException uoe) {
}
try {
"expected KeyStoreException");
} catch (KeyStoreException kse) {
// good
}
try {
"expected KeyStoreException");
} catch (KeyStoreException kse) {
}
try {
"expected KeyStoreException");
} catch (KeyStoreException kse) {
}
if (e instanceof KeyStore.PrivateKeyEntry) {
} else {
"expected PrivateKeyEntry");
}
try {
"expected KeyStoreException");
} catch (KeyStoreException kse) {
// good
}
if (e instanceof KeyStore.TrustedCertificateEntry) {
} else {
"expected TrustedCertificateEntry");
}
// TEST entryInstanceOf - invalid alias
} else {
}
// TEST entryInstanceOf - false case
} else {
}
// TEST entryInstanceOf - true case, trustedcert entry
KeyStore.TrustedCertificateEntry.class)) {
} else {
}
// TEST entryInstanceOf - true case, private key entry
KeyStore.PrivateKeyEntry.class)) {
} else {
}
}
if (!(e instanceof EntryMethods.FooEntry)) {
throw new SecurityException
("testPost15 getEntry(String, ProtParm) " +
"expected EntryMethods.FooEntry returned");
}
throw new SecurityException
("testPost15 entryInstanceOf(String, Class) " +
"expected true returned");
}
}
try {
throw new SecurityException
("UnrecoverableEntryException not thrown for " +
"getEntry(String, ProtectionParam)");
} catch (UnrecoverableEntryException uee) {
// good
}
}
// javac does not allow direct access to class (javac bug?)
// use reflection instead
try {
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
}
}
}
}
char[] password,
throws KeyStoreException {
}
throws KeyStoreException {
}
throws KeyStoreException {
}
throws KeyStoreException {
}
return jks.engineAliases();
}
}
public int engineSize() {
return jks.engineSize();
}
}
}
}
}
}
}
throw new IOException("Post15 engineStore method expected " +
"FooParameter");
}
}
throw new IOException("Post15 engineLoadFrom method expected " +
"FooParameter");
}
}
throws UnrecoverableEntryException {
throw new SecurityException
("Post15 engineGetEntry(String, ProtectionParam) " +
"expected [foo] alias");
}
throw new SecurityException
("Post15 engineGetEntry(String, ProtectionParam) " +
"expected [foobar] password");
}
return new EntryMethods.FooEntry();
}
throw new SecurityException
("Post15 engineSetEntry(String, entry, ProtParm) " +
"expected [foo] alias and EntryMethods.FooEntry");
}
throw new SecurityException
("Post15 engineSetEntry(String, entry, ProtParm) " +
"expected [foobar] password");
}
}
{
throw new SecurityException
("Post15 engineEntryInstanceOf(String, Class) " +
"expected [foo] alias " +
"and [KeyStore.PrivateKeyEntry] class");
}
return true;
}
}
throws UnrecoverableEntryException {
throw new UnrecoverableEntryException();
}
}
}