[英]How to Store Certificate Files Securely in Spring Cloud Config Server?
[英]How to encrypt pdf files securely
我有一個應用程序,其中spring-boot是后端,而jquery是前端。 我可以創建文檔,但無需加密或任何保護,因此需要弄清楚。
我需要保護pdf文件。 最好的方法是什么?
謝謝
我認為IText Engine可以輕松解決您的問題。
該工具包具有用於PDF生成和處理的便捷功能(包括帶有密碼的安全PDF和其他簽名加密系統)。
這是一個基本示例 :
PdfReader reader = new PdfReader(src);
WriterProperties props = new WriterProperties()
.setStandardEncryption(USERPASS, OWNERPASS, EncryptionConstants.ALLOW_PRINTING,
EncryptionConstants.ENCRYPTION_AES_128 | EncryptionConstants.DO_NOT_ENCRYPT_METADATA);
PdfWriter writer = new PdfWriter(new FileOutputStream(dest), props);
PdfDocument pdfDoc = new PdfDocument(reader, writer);
pdfDoc.close();
注意 :
請注意, USERPASS和OWNERPASS的類型為byte[]
public static byte[] USERPASS = "superuser".getBytes(); public static byte[] OWNERPASS = "superowner".getBytes();
您具有不同的權限選項(查找以EncryprionConstants
開頭的EncryprionConstants),還可以從不同的加密算法中進行選擇。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.