Security

AESCIPHER

AESCipher استفاده از رمزگذاری AES در حالت CBC برای بایت های موجود در PDF اسناد.

byte[] key = ...; // 128, 192, or 256-bit key
byte[] data = "sensitive data".getBytes();

byte[] ciphertext = AESCipher.encrypt(key, data);
byte[] plaintext  = AESCipher.decrypt(key, ciphertext);

برای رمزگذاری دایرکتوری با یک وکتور ابتکار صریح:

byte[] iv = new byte[16]; // 128-bit IV
byte[] ciphertext = AESCipher.encryptWithIV(key, iv, data);
byte[] plaintext  = AESCipher.decryptWithIV(key, iv, ciphertext);

PdfFileآموزش

PdfFileSecurity مدیریت رمز عبور سطح سند و مجوزهای دسترسی. و این encryptFile() روش یک رمز عبور کاربر، مالک را می پذیرد., DocumentPrivilege موضوع و اندازه کلیدی.

try (PdfFileSecurity security = new PdfFileSecurity("input.pdf", "secured.pdf")) {
    DocumentPrivilege priv = DocumentPrivilege.getForbidAll();
    priv.setAllowPrint(true);
    security.encryptFile("userPass", "ownerPass", priv, KeySize.x256);
}

decryptFile(ownerPassword) رمزگذاری را از یک سند رمزنگاری شده حذف کنید.

DocumentPrivilege

DocumentPrivilege نشان دهنده پرچم های مجوز برای اسناد رمزگذاری شده است. استفاده از getAllowAll() برای اعطای تمام مجوزها،, getForbidAll() همه را انکار می کند یا… اجازه های فردی را از طریق setAllowPrint(), setAllowModifyContents(), setAllowCopy()setAllowModifyAnnotations().

الگوریتم Enum

و این Algorithm enum انتخاب می کند که الگوریتم های رمزنگاری شده را انتخاب کنید:

  • Algorithm.RC4 – ارث RC4 جریان سیپر
  • Algorithm.AES – AES Block Chifer (توصیه شده)

See Also

 فارسی