use of java.security.Provider in project jdk8u_jdk by JetBrains.
the class TestJSSE method client.
public static void client(int testPort, String testProtocols, String testCipher, String... exception) throws Exception {
String expectedException = exception.length >= 1 ? exception[0] : null;
out.println("=========================================");
out.println(" Testing - https://" + LOCAL_IP + ":" + testPort);
out.println(" Testing - Protocol : " + testProtocols);
out.println(" Testing - Cipher : " + testCipher);
Provider p = new sun.security.ec.SunEC();
Security.insertProviderAt(p, 1);
try {
CipherTestUtils.main(new JSSEFactory(LOCAL_IP, testPort, testProtocols, testCipher, "client JSSE"), "client", expectedException);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of java.security.Provider in project jdk8u_jdk by JetBrains.
the class CaseSensitiveServices method main.
public static void main(String[] args) throws Exception {
Provider p = new CaseSensitiveServices();
System.out.println(p.getServices());
if (p.getServices().size() != 3) {
throw new Exception("services.size() should be 3");
}
Service s = testService(p, "MessageDigest", "fOO");
String val = s.getAttribute("Xyz");
if ("aBc".equals(val) == false) {
throw new Exception("Wrong value: " + val);
}
testService(p, "MessageDigest", "fU");
testService(p, "MessageDigest", "BAR");
testService(p, "MessageDigest", "baz");
System.out.println("OK");
}
use of java.security.Provider in project jdk8u_jdk by JetBrains.
the class ProviderVersionCheck method main.
public static void main(String[] arg) throws Exception {
boolean failure = false;
for (Provider p : Security.getProviders()) {
System.out.print(p.getName() + " ");
if (p.getVersion() != 1.8d) {
System.out.println("failed. " + "Version received was " + p.getVersion());
failure = true;
} else {
System.out.println("passed.");
}
}
if (failure) {
throw new Exception("Provider(s) failed to have the expected " + "version value.");
}
}
use of java.security.Provider in project jdk8u_jdk by JetBrains.
the class FinalizeHalf method main.
public static void main(String[] args) throws Throwable {
List<Consumer<Key>> methods = new ArrayList<>();
methods.add((Key k) -> k.getEncoded());
methods.add((Key k) -> k.toString());
for (String algo : new String[] { "DiffieHellman", "DSA", "RSA" }) {
for (Provider provider : Security.getProviders()) {
for (boolean priv : new boolean[] { true, false }) {
for (Consumer<Key> method : methods) {
test(algo, provider, priv, method);
}
}
}
}
if (failures > 0) {
throw new RuntimeException(failures + " test(s) failed.");
}
}
use of java.security.Provider in project symmetric-ds by JumpMind.
the class AbstractCommandLauncher method configureCrypto.
protected void configureCrypto(CommandLine line) throws Exception {
if (line.hasOption(OPTION_KEYSTORE_PASSWORD)) {
System.setProperty(SecurityConstants.SYSPROP_KEYSTORE_PASSWORD, line.getOptionValue(OPTION_KEYSTORE_PASSWORD));
}
if (line.hasOption(OPTION_KEYSTORE_TYPE)) {
System.setProperty(SystemConstants.SYSPROP_KEYSTORE_TYPE, line.getOptionValue(OPTION_KEYSTORE_TYPE));
}
if (line.hasOption(OPTION_JCE_PROVIDER)) {
Provider provider = (Provider) Class.forName(line.getOptionValue(OPTION_JCE_PROVIDER)).newInstance();
Security.addProvider(provider);
}
}
Aggregations