pdfstandardencryption.cs

来自「PDF文件格式解析库源代码」· CS 代码 · 共 112 行

CS
112
字号
using System;
using System.Collections.Generic;
using System.Text;
using AnotherPDFLib.PdfGraphics;

namespace AnotherPDFLib
{
	public partial class PdfStandardEncryption : PdfEncryption
	{
		/// <summary>
		/// A number specifying which revision of the standard security handler should be used to interpret this dictionary.
		/// </summary>
		public int Revision
		{
			get
			{
				PdfInteger revision = this["R"] as PdfInteger;
				if (revision != null)
				{
					return revision.Value;
				}
				return 0;
			}
			set
			{
				this["R"] = new PdfInteger(value);
			}
		}

		/// <summary>
		/// A 32-byte string, based on both the owner and user passwords, that is used in computing the encryption key and in determining whether a valid owner password was entered.
		/// </summary>
		public string Ownercheck
		{
			get
			{
				PdfString ownercheck = this["O"] as PdfString;
				if (ownercheck != null)
				{
					return ownercheck.Value;
				}
				return String.Empty;
			}
			set
			{
				this["O"] = new PdfString(value);
			}
		}

		/// <summary>
		/// A 32-byte string, based on the user password, that is used in determining whether to prompt the user for a password and, if so, whether a valid user or owner password was entered.
		/// </summary>
		public string Usercheck
		{
			get
			{
				PdfString usercheck = this["U"] as PdfString;
				if (usercheck != null)
				{
					return usercheck.Value;
				}
				return String.Empty;
			}
			set
			{
				this["U"] = new PdfString(value);
			}
		}

		/// <summary>
		/// A set of flags specifying which operations are permitted when the document is opened with user access.
		/// </summary>
		public int Permissions
		{
			get
			{
				PdfInteger permissions = this["P"] as PdfInteger;
				if (permissions != null)
				{
					return permissions.Value;
				}
				return 0;
			}
			set
			{
				this["P"] = new PdfInteger(value);
			}
		}

		/// <summary>
		/// Indicates whether the document-level metadata stream is to be encrypted.
		/// </summary>
		public bool EncryptMetadata
		{
			get
			{
				PdfBoolean encryptmetadata = this["EncryptMetadata"] as PdfBoolean;
				if (encryptmetadata != null)
				{
					return encryptmetadata.Value;
				}
				return true;
			}
			set
			{
				this["EncryptMetadata"] = new PdfBoolean(value);
			}
		}

	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?