use of java.security.Provider in project robovm by robovm.
the class invalidParams method testCertPathValidator08.
/**
* Test for <code>getInstance(String algorithm, Provider provider)</code> method
* Assertion: throws IllegalArgumentException when provider is null
*/
public void testCertPathValidator08() throws NoSuchAlgorithmException {
if (!PKIXSupport) {
fail(NotSupportMsg);
return;
}
Provider prov = null;
for (int t = 0; t < validValues.length; t++) {
try {
CertPathValidator.getInstance(validValues[t], prov);
fail("IllegalArgumentException must be thrown");
} catch (IllegalArgumentException e1) {
}
}
}
use of java.security.Provider in project robovm by robovm.
the class CertPathValidator2Test method testGetInstance03.
/**
* Test for <code>getInstance(String algorithm, Provider provider)</code>
* method Assertions: throws NullPointerException when algorithm is null
* throws NoSuchAlgorithmException when algorithm is not available throws
* IllegalArgumentException when provider is null; returns CertPathValidator
* object
*/
public void testGetInstance03() throws NoSuchAlgorithmException, IllegalArgumentException, InvalidAlgorithmParameterException, CertPathValidatorException {
try {
CertPathValidator.getInstance(null, mProv);
fail("NullPointerException or NoSuchAlgorithmException must be thrown when algorithm is null");
} catch (NullPointerException e) {
} catch (NoSuchAlgorithmException e) {
}
for (int i = 0; i < invalidValues.length; i++) {
try {
CertPathValidator.getInstance(invalidValues[i], mProv);
fail("NoSuchAlgorithmException must be thrown (type: ".concat(invalidValues[i]).concat(")"));
} catch (NoSuchAlgorithmException e) {
}
}
Provider prov = null;
for (int i = 0; i < validValues.length; i++) {
try {
CertPathValidator.getInstance(validValues[i], prov);
fail("IllegalArgumentException must be thrown when provider is null (type: ".concat(validValues[i]).concat(")"));
} catch (IllegalArgumentException e) {
}
}
CertPathValidator cerPV;
for (int i = 0; i < validValues.length; i++) {
cerPV = CertPathValidator.getInstance(validValues[i], mProv);
assertEquals("Incorrect type", cerPV.getAlgorithm(), validValues[i]);
assertEquals("Incorrect provider", cerPV.getProvider(), mProv);
checkResult(cerPV);
}
}
use of java.security.Provider in project robovm by robovm.
the class myCertificateFactory method testCertificateFactory06.
/**
* Test for <code>getInstance(String type, Provider provider)</code>
* method
* Assertion: throws IllegalArgumentException when provider is null
*/
public void testCertificateFactory06() throws CertificateException {
if (!X509Support) {
fail(NotSupportMsg);
return;
}
Provider provider = null;
for (int i = 0; i < validValues.length; i++) {
try {
CertificateFactory.getInstance(validValues[i], provider);
fail("IllegalArgumentException must be thrown when provider is null");
} catch (IllegalArgumentException e) {
}
}
}
use of java.security.Provider in project robovm by robovm.
the class ECDHKeyAgreementTest method invokeCallingMethodForEachKeyAgreementProvider.
private void invokeCallingMethodForEachKeyAgreementProvider() throws Exception {
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
String callingMethodName = null;
for (int i = 0; i < stackTrace.length; i++) {
if ("invokeCallingMethodForEachKeyAgreementProvider".equals(stackTrace[i].getMethodName())) {
callingMethodName = stackTrace[i + 1].getMethodName();
}
}
if (callingMethodName == null) {
throw new RuntimeException("Failed to deduce calling method name from stack trace");
}
String invokedMethodName = callingMethodName;
Method method;
try {
method = getClass().getDeclaredMethod(invokedMethodName, Provider.class);
} catch (NoSuchMethodError e) {
throw new AssertionFailedError("Failed to find per-Provider test method " + getClass().getSimpleName() + "." + invokedMethodName + "(Provider)");
}
for (Provider provider : getKeyAgreementProviders()) {
try {
method.invoke(this, provider);
} catch (InvocationTargetException e) {
throw new RuntimeException(getClass().getSimpleName() + "." + invokedMethodName + "(provider: " + provider.getName() + ") failed", e.getCause());
}
}
}
use of java.security.Provider in project robovm by robovm.
the class SSLContextTest method test_SSLContext_getProvider.
public void test_SSLContext_getProvider() throws Exception {
Provider provider = SSLContext.getDefault().getProvider();
assertNotNull(provider);
assertEquals(StandardNames.JSSE_PROVIDER_NAME, provider.getName());
}
Aggregations