use of java.security.SignatureException in project robovm by robovm.
the class SignatureExceptionTest method testSignatureException08.
/**
* Test for <code>SignatureException(String, Throwable)</code> constructor
* Assertion: constructs SignatureException when <code>cause</code> is not
* null <code>msg</code> is null
*/
public void testSignatureException08() {
SignatureException tE = new SignatureException(null, tCause);
if (tE.getMessage() != null) {
String toS = tCause.toString();
String getM = tE.getMessage();
assertTrue("getMessage() must should ".concat(toS), (getM.indexOf(toS) != -1));
}
assertNotNull("getCause() must not return null", tE.getCause());
assertEquals("getCause() must return ".concat(tCause.toString()), tE.getCause(), tCause);
}
use of java.security.SignatureException in project robovm by robovm.
the class SignatureExceptionTest method testSignatureException03.
/**
* Test for <code>SignatureException(String)</code> constructor Assertion:
* constructs SignatureException when <code>msg</code> is null
*/
public void testSignatureException03() {
String msg = null;
SignatureException tE = new SignatureException(msg);
assertNull("getMessage() must return null.", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
}
use of java.security.SignatureException in project robovm by robovm.
the class SignatureExceptionTest method testSignatureException06.
/**
* Test for <code>SignatureException(String, Throwable)</code> constructor
* Assertion: constructs SignatureException when <code>cause</code> is
* null <code>msg</code> is null
*/
public void testSignatureException06() {
SignatureException tE = new SignatureException(null, null);
assertNull("getMessage() must return null", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
}
use of java.security.SignatureException in project robovm by robovm.
the class DigestSignatureSpi method engineSign.
protected byte[] engineSign() throws SignatureException {
byte[] hash = new byte[digest.getDigestSize()];
digest.doFinal(hash, 0);
try {
byte[] bytes = derEncode(hash);
return cipher.processBlock(bytes, 0, bytes.length);
} catch (ArrayIndexOutOfBoundsException e) {
throw new SignatureException("key too small for signature type");
} catch (Exception e) {
throw new SignatureException(e.toString());
}
}
use of java.security.SignatureException in project robovm by robovm.
the class DSABase method engineVerify.
protected boolean engineVerify(byte[] sigBytes) throws SignatureException {
byte[] hash = new byte[digest.getDigestSize()];
digest.doFinal(hash, 0);
BigInteger[] sig;
try {
sig = encoder.decode(sigBytes);
} catch (Exception e) {
throw new SignatureException("error decoding signature bytes.");
}
return signer.verifySignature(hash, sig[0], sig[1]);
}
Aggregations