BVB Source Codes

PDF file browser Show PdfSecurityHandler.cs Source code

Return Download PDF file browser: download PdfSecurityHandler.cs Source code - Download PDF file browser Source code - Type:.cs
  1. //
  2. // PDFsharp - A library for processing PDF
  3. //
  4. // Authors:
  5. //   Stefan Lange (mailto:Stefan.Lange@pdfsharp.com)
  6. //
  7. // Copyright (c) 2005 empira Software GmbH, Cologne (Germany)
  8. //
  9. // http://www.pdfsharp.com
  10. //
  11. // Permission is hereby granted, free of charge, to any person obtaining
  12. // a copy of this software and associated documentation files (the
  13. // "Software"), to deal in the Software without restriction, including
  14. // without limitation the rights to use, copy, modify, merge, publish,
  15. // distribute, sublicense, and/or sell copies of the Software, and to
  16. // permit persons to whom the Software is furnished to do so, subject to
  17. // the following conditions:
  18. //
  19. // The above copyright notice and this permission notice shall be
  20. // included in all copies or substantial portions of the Software.
  21. //
  22. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  23. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  24. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  25. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  26. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  27. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  28. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  29.  
  30. using System;
  31. using System.Diagnostics;
  32. using System.Collections;
  33. using PdfSharp.Pdf;
  34. using PdfSharp.Internal;
  35. using PdfSharp.Drawing;
  36.  
  37. namespace PdfSharp.Pdf.Security
  38. {
  39.   /// <summary>
  40.   /// Represents the base of all security handlers.
  41.   /// </summary>
  42.   public abstract class PdfSecurityHandler : PdfDictionary
  43.   {
  44.     internal PdfSecurityHandler(PdfDocument document) : base(document)
  45.     {
  46.     }
  47.  
  48.     internal PdfSecurityHandler(PdfDictionary dict) : base(dict)
  49.     {
  50.     }
  51.  
  52.     /// <summary>
  53.     /// Predefined keys of this dictionary.
  54.     /// </summary>
  55.     internal class Keys : KeysBase
  56.     {
  57.       /// <summary>
  58.       /// (Required) The name of the preferred security handler for this document. Typically,
  59.       /// it is the name of the security handler that was used to encrypt the document. If
  60.       /// SubFilter is not present, only this security handler should be used when opening
  61.       /// the document. If it is present, consumer applications can use any security handler
  62.       /// that implements the format specified by SubFilter.
  63.       /// Standard is the name of the built-in password-based security handler. Names for other
  64.       /// security handlers can be registered by using the procedure described in Appendix E.
  65.       /// </summary>
  66.       [KeyInfo(KeyType.Name | KeyType.Required)]
  67.       public const string Filter = "/Filter";
  68.  
  69.       /// <summary>
  70.       /// (Optional; PDF 1.3) A name that completely specifies the format and interpretation of
  71.       /// the contents of the encryption dictionary. It is needed to allow security handlers other
  72.       /// than the one specified by Filter to decrypt the document. If this entry is absent, other
  73.       /// security handlers should not be allowed to decrypt the document.
  74.       /// </summary>
  75.       [KeyInfo("1.3", KeyType.Name | KeyType.Optional)]
  76.       public const string SubFilter = "/SubFilter";
  77.  
  78.       /// <summary>
  79.       /// (Optional but strongly recommended) A code specifying the algorithm to be used in encrypting
  80.       /// and decrypting the document:
  81.       /// 0 An algorithm that is undocumented and no longer supported, and whose use is strongly discouraged.
  82.       /// 1 Algorithm 3.1, with an encryption key length of 40 bits.
  83.       /// 2 (PDF 1.4) Algorithm 3.1, but permitting encryption key lengths greater than 40 bits.
  84.       /// 3 (PDF 1.4) An unpublished algorithm that permits encryption key lengths ranging from 40 to 128 bits.
  85.       /// 4 (PDF 1.5) The security handler defines the use of encryption and decryption in the document, using
  86.       ///             the rules specified by the CF, StmF, and StrF entries.
  87.       /// The default value if this entry is omitted is 0, but a value of 1 or greater is strongly recommended.
  88.       /// </summary>
  89.       [KeyInfo(KeyType.Integer | KeyType.Optional)]
  90.       public const string V = "/V";
  91.  
  92.       /// <summary>
  93.       /// (Optional; PDF 1.4; only if V is 2 or 3) The length of the encryption key, in bits.
  94.       /// The value must be a multiple of 8, in the range 40 to 128. Default value: 40.
  95.       /// </summary>
  96.       [KeyInfo("1.4", KeyType.Integer | KeyType.Optional)]
  97.       public const string Length = "/Length";
  98.  
  99.       /// <summary>
  100.       /// (Optional; meaningful only when the value of V is 4; PDF 1.5)
  101.       /// A dictionary whose keys are crypt filter names and whose values are the corresponding
  102.       /// crypt filter dictionaries. Every crypt filter used in the document must have an entry
  103.       /// in this dictionary, except for the standard crypt filter names.
  104.       /// </summary>
  105.       [KeyInfo(KeyType.Dictionary | KeyType.Optional)]
  106.       public const string CF = "/CF";
  107.  
  108.       /// <summary>
  109.       /// (Optional; meaningful only when the value of V is 4; PDF 1.5)
  110.       /// The name of the crypt filter that is used by default when decrypting streams.
  111.       /// The name must be a key in the CF dictionary or a standard crypt filter name. All streams
  112.       /// in the document, except for cross-reference streams or streams that have a Crypt entry in
  113.       /// their Filter array, are decrypted by the security handler, using this crypt filter.
  114.       /// Default value: Identity.
  115.       /// </summary>
  116.       [KeyInfo("1.5", KeyType.Name | KeyType.Optional)]
  117.       public const string StmF = "/StmF";
  118.  
  119.       /// <summary>
  120.       /// (Optional; meaningful only when the value of V is 4; PDF 1.)
  121.       /// The name of the crypt filter that is used when decrypting all strings in the document.
  122.       /// The name must be a key in the CF dictionary or a standard crypt filter name.
  123.       /// Default value: Identity.
  124.       /// </summary>
  125.       [KeyInfo("1.5", KeyType.Name | KeyType.Optional)]
  126.       public const string StrF = "/StrF";
  127.  
  128.       /// <summary>
  129.       /// (Optional; meaningful only when the value of V is 4; PDF 1.6)
  130.       /// The name of the crypt filter that should be used by default when encrypting embedded
  131.       /// file streams; it must correspond to a key in the CF dictionary or a standard crypt
  132.       /// filter name. This entry is provided by the security handler. Applications should respect
  133.       /// this value when encrypting embedded files, except for embedded file streams that have
  134.       /// their own crypt filter specifier. If this entry is not present, and the embedded file
  135.       /// stream does not contain a crypt filter specifier, the stream should be encrypted using
  136.       /// the default stream crypt filter specified by StmF.
  137.       /// </summary>
  138.       [KeyInfo("1.6", KeyType.Name | KeyType.Optional)]
  139.       public const string EFF = "/EFF";
  140.     }
  141.   }
  142. }
  143.  
downloadPdfSecurityHandler.cs Source code - Download PDF file browser Source code
Related Source Codes/Software:
Campus id - This system includes a campus dormitory management... 2015-04-10
ShopXP online system source code - ShopXP ShoppingNet online system source code infor... 2015-04-10
TOM cat demo in learning to speak - 实现汤米猫学说话的演示,即实现变声功能鲜豔,,,,,,,开发者说:自己经常来看code4app,看看... 2015-04-10
Another OpenFolder - Implements can commence in the middle of the scree... 2015-04-10
Bus query system - A simple bus query system. Can be divided into rou... 2015-04-10
Customer service management system - To a store and development of customer service man... 2015-04-10
OA office automation system - OA office automation system is tomorrow technology... 2015-04-10
Chapters novel divider (ChapCuttor) - Chapter divider (ChapCuttor) by & have spent Black... 2015-04-10
Graduation design file (graphics algorithm design) - Reference image effect algorithm design the softwa... 2015-04-10
CheatEngine5.6 source code - Game cheat the 5.6 version of the source code, it ... 2015-04-10
Online ZhaXunWang science formula query V1.0 - Including junior middle school and high school sci... 2016-10-20
Observe science formula query v1.0 - Observe network science formulas 2016-10-20
Lele v1.1 QQ login system - "Le Le QQ Group landing system Ver1.1" * Fix QQ ... 2016-10-20
The new network domain name host distribution system V1.0 - Use Notepad to open \Global.asa idc1688 into your ... 2016-10-20
QQ group v2.1 release system - ha ha - "Copyright" This system is based on the Wu Meng de... 2016-10-20
Interesting content ASPCMS v1.0 - Update log: 2016-10-20
Residential feng shui fortune-telling v1.0 - The project according to the orientation of the ar... 2016-10-20
The self-help chain home beautiful - The self-help chain home beautiful 2016-10-20
EXW FLASH web site management system v2.0 - EXW FLASH introduction: EXW website management sys... 2016-10-20
WAP2.0 web site management system V1.0 - System installation steps 1, install the QuickWAP ... 2016-10-20

 Back to top