use of java.security.spec.PSSParameterSpec in project j2objc by google.
the class PSSParameterSpecTest method testGetSaltLength.
/**
* Test for <code>getSaltLength()</code> method<br>
* Assertion: returns salt length value
*/
public final void testGetSaltLength() {
PSSParameterSpec pssps = new PSSParameterSpec(20);
assertEquals(20, pssps.getSaltLength());
}
use of java.security.spec.PSSParameterSpec in project j2objc by google.
the class PSSParameterSpecTest method testGetMGFAlgorithm.
/**
* Test for <code>getMGFAlgorithm()</code> method
* Assertion: returns mask generation function algorithm name
*/
public final void testGetMGFAlgorithm() {
PSSParameterSpec pssps = new PSSParameterSpec("SHA-1", "MGF1", MGF1ParameterSpec.SHA1, 20, 1);
assertEquals("MGF1", pssps.getMGFAlgorithm());
}
use of java.security.spec.PSSParameterSpec in project robovm by robovm.
the class myMac method testInit.
/**
* Test for
* <code>init(Key key, AlgorithmParameterSpec params)</code>
* <code>init(Key key)</code>
* methods
* Assertion: throws InvalidKeyException and InvalidAlgorithmParameterException
* when parameters are not appropriate
*/
public void testInit() throws NoSuchAlgorithmException, NoSuchProviderException, IllegalArgumentException, IllegalStateException, InvalidAlgorithmParameterException, InvalidKeyException {
if (!DEFSupported) {
fail(NotSupportedMsg);
return;
}
Mac[] macs = createMacs();
assertNotNull("Mac objects were not created", macs);
byte[] b = { (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5 };
SecretKeySpec sks = new SecretKeySpec(b, "SHA1");
DHGenParameterSpec algPS = new DHGenParameterSpec(1, 2);
PSSParameterSpec algPSS = new PSSParameterSpec(20);
SecretKeySpec sks1 = new SecretKeySpec(b, "RSA");
for (int i = 0; i < macs.length; i++) {
macs[i].init(sks);
try {
macs[i].init(sks1, algPSS);
fail("init(..) accepts incorrect AlgorithmParameterSpec parameter");
} catch (InvalidAlgorithmParameterException e) {
}
try {
macs[i].init(sks, algPS);
fail("init(..) accepts incorrect AlgorithmParameterSpec parameter");
} catch (InvalidAlgorithmParameterException e) {
}
try {
macs[i].init(null, null);
fail("InvalidKeyException must be thrown");
} catch (InvalidKeyException e) {
}
try {
macs[i].init(null);
fail("InvalidKeyException must be thrown");
} catch (InvalidKeyException e) {
}
// macs[i].init(sks, null);
}
}
use of java.security.spec.PSSParameterSpec in project robovm by robovm.
the class PSSParameterSpecTest method testPSSParameterSpec0201.
/**
* Test #1 for
* <code>
* PSSParameterSpec(String,String,AlgorithmParameterSpec,int,int)
* </code> ctor<br>
* Assertion: constructs using valid parameters
* <code>PSSParameterSpec<code> object
*/
public final void testPSSParameterSpec0201() {
AlgorithmParameterSpec aps = new PSSParameterSpec("SHA-1", "MGF1", MGF1ParameterSpec.SHA1, 20, 1);
assertTrue(aps instanceof PSSParameterSpec);
}
use of java.security.spec.PSSParameterSpec in project robovm by robovm.
the class PSSParameterSpecTest method testGetSaltLength.
/**
* Test for <code>getSaltLength()</code> method<br>
* Assertion: returns salt length value
*/
public final void testGetSaltLength() {
PSSParameterSpec pssps = new PSSParameterSpec(20);
assertEquals(20, pssps.getSaltLength());
}
Aggregations