foundRecipient = true;
}
}
}
catch (Exception f) {
throw new ExceptionConverter(f);
}
}
if(!foundRecipient || envelopedData == null) {
throw new UnsupportedPdfException(MessageLocalization.getComposedMessage("bad.certificate.and.key"));
}
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA-1");
md.update(envelopedData, 0, 20);
for (int i = 0; i<recipients.size(); i++) {
byte[] encodedRecipient = recipients.getPdfObject(i).getBytes();
md.update(encodedRecipient);
}
if ((cryptoMode & PdfWriter.DO_NOT_ENCRYPT_METADATA) != 0)
md.update(new byte[]{(byte)255, (byte)255, (byte)255, (byte)255});
encryptionKey = md.digest();
}
catch (Exception f) {
throw new ExceptionConverter(f);
}
}
decrypt = new PdfEncryption();