envelopedData = recipientInfo.getContent(certificateKey, certificateKeyProvider);
foundRecipient = true;
}
}
} catch (Exception f) {
throw new ExceptionConverter(f);
}
}
if(!foundRecipient || envelopedData == null)
{
throw new IOException("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 = ((PdfObject)recipients.getArrayList().get(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();