下面列出了java.security.SignatureException#getMessage ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public boolean validateSignature(Manager dbManager) throws ValidateSignatureException {
try {
byte[] sigAddress = ECKey.signatureToAddress(getRawHash().getBytes(),
TransactionWrapper.getBase64FromByteString(block.getBlockHeader().getWitnessSignature()));
byte[] witnessAccountAddress = block.getBlockHeader().getRawData().getWitnessAddress()
.toByteArray();
if (dbManager.getDynamicPropertiesStore().getAllowMultiSign() != 1) {
return Arrays.equals(sigAddress, witnessAccountAddress);
} else {
byte[] witnessPermissionAddress = dbManager.getAccountStore().get(witnessAccountAddress)
.getWitnessPermissionAddress();
return Arrays.equals(sigAddress, witnessPermissionAddress);
}
} catch (SignatureException e) {
throw new ValidateSignatureException(e.getMessage());
}
}
/**
* Test for <code>SignatureException(Throwable)</code> constructor
* Assertion: constructs SignatureException when <code>cause</code> is not
* null
*/
public void testSignatureException05() {
SignatureException tE = new SignatureException(tCause);
if (tE.getMessage() != null) {
String toS = tCause.toString();
String getM = tE.getMessage();
assertTrue("getMessage() should contain ".concat(toS), (getM
.indexOf(toS) != -1));
}
assertNotNull("getCause() must not return null", tE.getCause());
assertEquals("getCause() must return ".concat(tCause.toString()), tE
.getCause(), tCause);
}
/**
* 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);
}
@Override
public void write(int singleByte) throws IOException {
try {
signer.update((byte) singleByte);
} catch (SignatureException ex) {
throw new IOException(ex.getMessage(), ex);
}
}
@Override
public void write(byte[] bytes) throws IOException {
try {
signer.update(bytes);
} catch (SignatureException ex) {
throw new IOException(ex.getMessage(), ex);
}
}
@Override
public void write(byte[] bytes, int off, int len) throws IOException {
try {
signer.update(bytes, off, len);
} catch (SignatureException ex) {
throw new IOException(ex.getMessage(), ex);
}
}
@Override
public byte[] getSignature() {
try {
return stream.getSignature();
} catch (SignatureException ex) {
throw new RuntimeOperatorException("exception obtaining signature: " + ex.getMessage(), ex);
}
}