/*
* Check block digest.
*/
byte[] digest = payload.getDigest();
if (digest != null) {
computedBlockDigest = new Digest();
computedBlockDigest.digestBytes = digest;
computedBlockDigest.algorithm = reader.blockDigestAlgorithm;
if (reader.blockDigestEncoding != null) {
if ("base32".equals(reader.blockDigestEncoding)) {
computedBlockDigest.encoding = "base32";
computedBlockDigest.digestString = Base32.encodeArray(computedBlockDigest.digestBytes);
} else if ("base64".equals(reader.blockDigestEncoding)) {
computedBlockDigest.encoding = "base64";
computedBlockDigest.digestString = Base64.encodeArray(computedBlockDigest.digestBytes);
} else if ("base16".equals(reader.blockDigestEncoding)) {
computedBlockDigest.encoding = "base16";
computedBlockDigest.digestString = Base16.encodeArray(computedBlockDigest.digestBytes);
} else {
// Encoding - Unknown block digest encoding scheme ..
addErrorDiagnosis(DiagnosisType.INVALID_DATA,
"Block digest encoding scheme",
reader.blockDigestEncoding);
}
}
}
PayloadWithHeaderAbstract payloadHeaderWrapped = payload.getPayloadHeaderWrapped();
if (payloadHeaderWrapped != null && payloadHeaderWrapped.isValid()) {
/*
* Check payload digest.
*/
digest = payloadHeaderWrapped.getDigest();
if (digest != null) {
computedPayloadDigest = new Digest();
computedPayloadDigest.digestBytes = digest;
computedPayloadDigest.algorithm = reader.payloadDigestAlgorithm;
if (reader.payloadDigestEncoding != null) {
if ("base32".equals(reader.payloadDigestEncoding)) {
computedPayloadDigest.encoding = "base32";