public void setEncryption ( Certificate [ ] certs , int [ ] permissions , int encryptionType ) throws DocumentException { if ( stamper . isAppend ( ) ) throw new DocumentException ( "Append mode does not support changing the encryption status." ) ; if ( stamper . isContentWritten ( ) ) throw new DocumentException ( "Content was already written to the output." ) ; stamper . setEncryption ( certs , permissions , encryptionType ) ; }
Sets the certificate encryption options for this document . An array of one or more public certificates must be provided together with an array of the same size for the permissions for each certificate . The open permissions for the document can be AllowPrinting AllowModifyContents AllowCopy AllowModifyAnnotations AllowFillIn AllowScreenReaders AllowAssembly and AllowDegradedPrinting . The permissions can be combined by ORing them . Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext