1
#region PDFsharp - A .NET library for processing PDF
4
// Stefan Lange (mailto:Stefan.Lange@pdfsharp.com)
6
// Copyright (c) 2005-2008 empira Software GmbH, Cologne (Germany)
8
// http://www.pdfsharp.com
9
// http://sourceforge.net/projects/pdfsharp
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:
18
// The above copyright notice and this permission notice shall be included
19
// in all copies or substantial portions of the Software.
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.
31
using System.Diagnostics;
32
using System.Collections;
33
using PdfSharp.Pdf.Internal;
35
namespace PdfSharp.Pdf.AcroForms
38
/// Represents the signature field.
40
public sealed class PdfSignatureField : PdfAcroField
43
/// Initializes a new instance of PdfSignatureField.
45
internal PdfSignatureField(PdfDocument document) : base(document)
49
internal PdfSignatureField(PdfDictionary dict) : base(dict)
54
/// Predefined keys of this dictionary.
55
/// The description comes from PDF 1.4 Reference.
57
public new class Keys : PdfAcroField.Keys
60
/// (Optional) The type of PDF object that this dictionary describes; if present,
61
/// must be Sig for a signature dictionary.
63
[KeyInfo(KeyType.Name | KeyType.Optional)]
64
public const string Type = "/Type";
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.
71
[KeyInfo(KeyType.Name | KeyType.Required)]
72
public const string Filter = "/Filter";
75
/// (Optional) The name of a specific submethod of the specified handler.
77
[KeyInfo(KeyType.Name | KeyType.Optional)]
78
public const string SubFilter = "/SubFilter";
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.
86
[KeyInfo(KeyType.Array | KeyType.Required)]
87
public const string ByteRange = "/ByteRange";
90
/// (Required) The encrypted signature token.
92
[KeyInfo(KeyType.String | KeyType.Required)]
93
public const string Contents = "/Contents";
96
/// (Optional) The name of the person or authority signing the document.
98
[KeyInfo(KeyType.TextString | KeyType.Optional)]
99
public const string Name = "/Name";
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.
106
[KeyInfo(KeyType.Date | KeyType.Optional)]
107
public const string M = "/M";
110
/// (Optional) The CPU host name or physical location of the signing.
112
[KeyInfo(KeyType.TextString| KeyType.Optional)]
113
public const string Location = "/Location";
116
/// (Optional) The reason for the signing, such as (I agree�).
118
[KeyInfo(KeyType.TextString| KeyType.Optional)]
119
public const string Reason = "/Reason";
122
/// Gets the KeysMeta for these keys.
124
internal static DictionaryMeta Meta
128
if (Keys.meta == null)
129
Keys.meta = CreateMeta(typeof(Keys));
133
static DictionaryMeta meta;
137
/// Gets the KeysMeta of this dictionary type.
139
internal override DictionaryMeta Meta
141
get {return Keys.Meta;}