if( !document.isEncrypted() )
{
if( certFile != null )
{
PublicKeyProtectionPolicy ppp = new PublicKeyProtectionPolicy();
PublicKeyRecipient recip = new PublicKeyRecipient();
recip.setPermission(ap);
CertificateFactory cf = CertificateFactory.getInstance("X.509");
InputStream inStream = new FileInputStream(certFile);
X509Certificate certificate = (X509Certificate)cf.generateCertificate(inStream);
inStream.close();
recip.setX509(certificate);
ppp.addRecipient(recip);
ppp.setEncryptionKeyLength(keyLength);