2
* crypto.h - public data structures and prototypes for the crypto library
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/
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.
14
* The Original Code is the Netscape security libraries.
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
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
35
* $Id: secdig.h,v 1.3 2001/05/02 21:34:13 wtc%netscape.com Exp $
50
extern const SEC_ASN1Template sgn_DigestInfoTemplate[];
52
SEC_ASN1_CHOOSER_DECLARE(sgn_DigestInfoTemplate)
54
extern DERTemplate SGNDigestInfoTemplate[];
57
/****************************************/
59
** Digest-info functions
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
68
** NOTE: this is a low level routine used to prepare some data for PKCS#1
69
** digital signature formatting.
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.
74
extern SGNDigestInfo *SGN_CreateDigestInfo(SECOidTag algorithm,
79
** Destroy a digest-info object
81
extern void SGN_DestroyDigestInfo(SGNDigestInfo *info);
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).
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.
96
extern SECItem *SGN_EncodeDigestInfo(PRArenaPool *poolp, SECItem *dest,
97
SGNDigestInfo *diginfo);
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.
107
extern SGNDigestInfo *SGN_DecodeDigestInfo(SECItem *didata);
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.
122
extern SECStatus SGN_CopyDigestInfo(PRArenaPool *poolp,
127
** Compare two digest-info objects, returning the difference between
130
extern SECComparison SGN_CompareDigestInfo(SGNDigestInfo *a, SGNDigestInfo *b);
135
#endif /* _SECDIG_H_ */