~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/security/nss/lib/util/secdig.h

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * crypto.h - public data structures and prototypes for the crypto library
 
3
 *
 
4
 * The contents of this file are subject to the Mozilla Public
 
5
 * License Version 1.1 (the "License"); you may not use this file
 
6
 * except in compliance with the License. You may obtain a copy of
 
7
 * the License at http://www.mozilla.org/MPL/
 
8
 * 
 
9
 * Software distributed under the License is distributed on an "AS
 
10
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 
11
 * implied. See the License for the specific language governing
 
12
 * rights and limitations under the License.
 
13
 * 
 
14
 * The Original Code is the Netscape security libraries.
 
15
 * 
 
16
 * The Initial Developer of the Original Code is Netscape
 
17
 * Communications Corporation.  Portions created by Netscape are 
 
18
 * Copyright (C) 1994-2000 Netscape Communications Corporation.  All
 
19
 * Rights Reserved.
 
20
 * 
 
21
 * Contributor(s):
 
22
 * 
 
23
 * Alternatively, the contents of this file may be used under the
 
24
 * terms of the GNU General Public License Version 2 or later (the
 
25
 * "GPL"), in which case the provisions of the GPL are applicable 
 
26
 * instead of those above.  If you wish to allow use of your 
 
27
 * version of this file only under the terms of the GPL and not to
 
28
 * allow others to use your version of this file under the MPL,
 
29
 * indicate your decision by deleting the provisions above and
 
30
 * replace them with the notice and other provisions required by
 
31
 * the GPL.  If you do not delete the provisions above, a recipient
 
32
 * may use your version of this file under either the MPL or the
 
33
 * GPL.
 
34
 *
 
35
 * $Id: secdig.h,v 1.3 2001/05/02 21:34:13 wtc%netscape.com Exp $
 
36
 */
 
37
 
 
38
#ifndef _SECDIG_H_
 
39
#define _SECDIG_H_
 
40
 
 
41
#include "secdigt.h"
 
42
 
 
43
#include "seccomon.h"
 
44
#include "secasn1t.h" 
 
45
#include "secdert.h"
 
46
 
 
47
SEC_BEGIN_PROTOS
 
48
 
 
49
 
 
50
extern const SEC_ASN1Template sgn_DigestInfoTemplate[];
 
51
 
 
52
SEC_ASN1_CHOOSER_DECLARE(sgn_DigestInfoTemplate)
 
53
 
 
54
extern DERTemplate SGNDigestInfoTemplate[];
 
55
 
 
56
 
 
57
/****************************************/
 
58
/*
 
59
** Digest-info functions
 
60
*/
 
61
 
 
62
/*
 
63
** Create a new digest-info object
 
64
**      "algorithm" one of SEC_OID_MD2, SEC_OID_MD5, or SEC_OID_SHA1
 
65
**      "sig" the raw signature data (from MD2 or MD5)
 
66
**      "sigLen" the length of the signature data
 
67
**
 
68
** NOTE: this is a low level routine used to prepare some data for PKCS#1
 
69
** digital signature formatting.
 
70
**
 
71
** XXX It might be nice to combine the create and encode functions.
 
72
** I think that is all anybody ever wants to do anyway.
 
73
*/
 
74
extern SGNDigestInfo *SGN_CreateDigestInfo(SECOidTag algorithm,
 
75
                                           unsigned char *sig,
 
76
                                           unsigned int sigLen);
 
77
 
 
78
/*
 
79
** Destroy a digest-info object
 
80
*/
 
81
extern void SGN_DestroyDigestInfo(SGNDigestInfo *info);
 
82
 
 
83
/*
 
84
** Encode a digest-info object
 
85
**      "poolp" is where to allocate the result from; it can be NULL in
 
86
**              which case generic heap allocation (XP_ALLOC) will be used
 
87
**      "dest" is where to store the result; it can be NULL, in which case
 
88
**              it will be allocated (from poolp or heap, as explained above)
 
89
**      "diginfo" is the object to be encoded
 
90
** The return value is NULL if any error occurred, otherwise it is the
 
91
** resulting SECItem (either allocated or the same as the "dest" parameter).
 
92
**
 
93
** XXX It might be nice to combine the create and encode functions.
 
94
** I think that is all anybody ever wants to do anyway.
 
95
*/
 
96
extern SECItem *SGN_EncodeDigestInfo(PRArenaPool *poolp, SECItem *dest,
 
97
                                     SGNDigestInfo *diginfo);
 
98
 
 
99
/*
 
100
** Decode a DER encoded digest info objct.
 
101
**  didata is thr source of the encoded digest.  
 
102
** The return value is NULL if an error occurs.  Otherwise, a
 
103
** digest info object which is allocated within it's own
 
104
** pool is returned.  The digest info should be deleted
 
105
** by later calling SGN_DestroyDigestInfo.
 
106
*/
 
107
extern SGNDigestInfo *SGN_DecodeDigestInfo(SECItem *didata);
 
108
 
 
109
 
 
110
/*
 
111
** Copy digest info.
 
112
**  poolp is the arena to which the digest will be copied.
 
113
**  a is the destination digest, it must be non-NULL.
 
114
**  b is the source digest
 
115
** This function is for copying digests.  It allows digests
 
116
** to be copied into a specified pool.  If the digest is in
 
117
** the same pool as other data, you do not want to delete
 
118
** the digest by calling SGN_DestroyDigestInfo.  
 
119
** A return value of SECFailure indicates an error.  A return
 
120
** of SECSuccess indicates no error occured.
 
121
*/
 
122
extern SECStatus  SGN_CopyDigestInfo(PRArenaPool *poolp,
 
123
                                        SGNDigestInfo *a, 
 
124
                                        SGNDigestInfo *b);
 
125
 
 
126
/*
 
127
** Compare two digest-info objects, returning the difference between
 
128
** them.
 
129
*/
 
130
extern SECComparison SGN_CompareDigestInfo(SGNDigestInfo *a, SGNDigestInfo *b);
 
131
 
 
132
 
 
133
SEC_END_PROTOS
 
134
 
 
135
#endif /* _SECDIG_H_ */