throws PermFailException {
return new BodyHasherImpl(signRecord);
}
public String sign(InputStream is) throws IOException, FailException {
Message message;
try {
try {
message = new Message(is);
} catch (RuntimeException e) {
throw e;
} catch (IOException e) {
throw e;
} catch (Exception e1) {
// This can only be a MimeException but we don't declare to allow usage of
// DKIMSigner without Mime4J dependency.
throw new PermFailException("MIME parsing exception: "
+ e1.getMessage(), e1);
}
try {
SignatureRecord srt = newSignatureRecordTemplate(signatureRecordTemplate);
BodyHasher bhj = newBodyHasher(srt);
// computation of the body hash.
DKIMCommon.streamCopy(message.getBodyInputStream(), bhj
.getOutputStream());
return sign(message, bhj);
} finally {
message.dispose();
}
} finally {
is.close();
}