~ubuntu-branches/ubuntu/trusty/pdfmod/trusty

« back to all changes in this revision

Viewing changes to lib/PdfSharp/PdfSharp.Pdf.AcroForms/PdfSignatureField.cs

  • Committer: Bazaar Package Importer
  • Author(s): Chow Loong Jin
  • Date: 2010-06-18 03:44:46 UTC
  • Revision ID: james.westby@ubuntu.com-20100618034446-bogifrsscpayp361
Tags: upstream-0.8.3
Import upstream version 0.8.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#region PDFsharp - A .NET library for processing PDF
 
2
//
 
3
// Authors:
 
4
//   Stefan Lange (mailto:Stefan.Lange@pdfsharp.com)
 
5
//
 
6
// Copyright (c) 2005-2008 empira Software GmbH, Cologne (Germany)
 
7
//
 
8
// http://www.pdfsharp.com
 
9
// http://sourceforge.net/projects/pdfsharp
 
10
//
 
11
// Permission is hereby granted, free of charge, to any person obtaining a
 
12
// copy of this software and associated documentation files (the "Software"),
 
13
// to deal in the Software without restriction, including without limitation
 
14
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
 
15
// and/or sell copies of the Software, and to permit persons to whom the
 
16
// Software is furnished to do so, subject to the following conditions:
 
17
//
 
18
// The above copyright notice and this permission notice shall be included
 
19
// in all copies or substantial portions of the Software.
 
20
//
 
21
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
22
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
23
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 
24
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
25
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 
26
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
 
27
// DEALINGS IN THE SOFTWARE.
 
28
#endregion
 
29
 
 
30
using System;
 
31
using System.Diagnostics;
 
32
using System.Collections;
 
33
using PdfSharp.Pdf.Internal;
 
34
 
 
35
namespace PdfSharp.Pdf.AcroForms
 
36
{
 
37
  /// <summary>
 
38
  /// Represents the signature field.
 
39
  /// </summary>
 
40
  public sealed class PdfSignatureField : PdfAcroField
 
41
  {
 
42
    /// <summary>
 
43
    /// Initializes a new instance of PdfSignatureField.
 
44
    /// </summary>
 
45
    internal PdfSignatureField(PdfDocument document) : base(document)
 
46
    {
 
47
    }
 
48
 
 
49
    internal PdfSignatureField(PdfDictionary dict) : base(dict)
 
50
    {
 
51
    }
 
52
 
 
53
    /// <summary>
 
54
    /// Predefined keys of this dictionary. 
 
55
    /// The description comes from PDF 1.4 Reference.
 
56
    /// </summary>
 
57
    public new class Keys : PdfAcroField.Keys
 
58
    {
 
59
      /// <summary>
 
60
      /// (Optional) The type of PDF object that this dictionary describes; if present,
 
61
      /// must be Sig for a signature dictionary.
 
62
      /// </summary>
 
63
      [KeyInfo(KeyType.Name | KeyType.Optional)]
 
64
      public const string Type = "/Type";
 
65
 
 
66
      /// <summary>
 
67
      /// (Required; inheritable) The name of the signature handler to be used for
 
68
      /// authenticating the field�s contents, such as Adobe.PPKLite, Entrust.PPKEF,
 
69
      /// CICI.SignIt, or VeriSign.PPKVS.
 
70
      /// </summary>
 
71
      [KeyInfo(KeyType.Name | KeyType.Required)]
 
72
      public const string Filter = "/Filter";
 
73
 
 
74
      /// <summary>
 
75
      /// (Optional) The name of a specific submethod of the specified handler.
 
76
      /// </summary>
 
77
      [KeyInfo(KeyType.Name | KeyType.Optional)]
 
78
      public const string SubFilter = "/SubFilter";
 
79
 
 
80
      /// <summary>
 
81
      /// (Required) An array of pairs of integers (starting byte offset, length in bytes)
 
82
      /// describing the exact byte range for the digest calculation. Multiple discontiguous
 
83
      /// byte ranges may be used to describe a digest that does not include the
 
84
      /// signature token itself.
 
85
      /// </summary>
 
86
      [KeyInfo(KeyType.Array | KeyType.Required)]
 
87
      public const string ByteRange = "/ByteRange";
 
88
 
 
89
      /// <summary>
 
90
      /// (Required) The encrypted signature token.
 
91
      /// </summary>
 
92
      [KeyInfo(KeyType.String | KeyType.Required)]
 
93
      public const string Contents = "/Contents";
 
94
 
 
95
      /// <summary>
 
96
      /// (Optional) The name of the person or authority signing the document.
 
97
      /// </summary>
 
98
      [KeyInfo(KeyType.TextString | KeyType.Optional)]
 
99
      public const string Name = "/Name";
 
100
 
 
101
      /// <summary>
 
102
      /// (Optional) The time of signing. Depending on the signature handler, this
 
103
      /// may be a normal unverified computer time or a time generated in a verifiable
 
104
      /// way from a secure time server.
 
105
      /// </summary>
 
106
      [KeyInfo(KeyType.Date | KeyType.Optional)]
 
107
      public const string M = "/M";
 
108
 
 
109
      /// <summary>
 
110
      /// (Optional) The CPU host name or physical location of the signing.
 
111
      /// </summary>
 
112
      [KeyInfo(KeyType.TextString| KeyType.Optional)]
 
113
      public const string Location = "/Location";
 
114
 
 
115
      /// <summary>
 
116
      /// (Optional) The reason for the signing, such as (I agree�).
 
117
      /// </summary>
 
118
      [KeyInfo(KeyType.TextString| KeyType.Optional)]
 
119
      public const string Reason = "/Reason";
 
120
 
 
121
      /// <summary>
 
122
      /// Gets the KeysMeta for these keys.
 
123
      /// </summary>
 
124
      internal static DictionaryMeta Meta
 
125
      {
 
126
        get
 
127
        {
 
128
          if (Keys.meta == null)
 
129
            Keys.meta = CreateMeta(typeof(Keys));
 
130
          return Keys.meta;
 
131
        }
 
132
      }
 
133
      static DictionaryMeta meta;
 
134
    }
 
135
 
 
136
    /// <summary>
 
137
    /// Gets the KeysMeta of this dictionary type.
 
138
    /// </summary>
 
139
    internal override DictionaryMeta Meta
 
140
    {
 
141
      get {return Keys.Meta;}
 
142
    }
 
143
  }
 
144
}