/// <summary> /// Encrypt content of /// <c>value</c> /// and set as content. /// <c>generateContent()</c> /// won't be called. /// </summary> /// <param name="encrypt">@see PdfEncryption</param> /// <returns>true if value was encrypted, otherwise false.</returns> protected internal virtual bool Encrypt(PdfEncryption encrypt) { if (encrypt != null && !encrypt.IsEmbeddedFilesOnly()) { byte[] b = encrypt.EncryptByteArray(GetValueBytes()); content = EncodeBytes(b); return(true); } return(false); }
/// <summary> /// Encrypt content of /// <c>value</c> /// and set as content. /// <c>generateContent()</c> /// won't be called. /// </summary> /// <param name="encrypt">@see PdfEncryption</param> /// <returns>true if value was encrypted, otherwise false.</returns> protected internal virtual bool Encrypt(PdfEncryption encrypt) { if (CheckState(PdfObject.UNENCRYPTED)) { return(false); } if (encrypt != decryption) { if (decryption != null) { GenerateValue(); } if (encrypt != null && !encrypt.IsEmbeddedFilesOnly()) { byte[] b = encrypt.EncryptByteArray(GetValueBytes()); content = EncodeBytes(b); return(true); } } return(false); }