3 * $Id: pkcs1.h,v 1.1 2000/07/01 11:17:38 mdw Exp $
7 * (c) 2000 Straylight/Edgeware
10 /*----- Licensing notice --------------------------------------------------*
12 * This file is part of Catacomb.
14 * Catacomb is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU Library General Public License as
16 * published by the Free Software Foundation; either version 2 of the
17 * License, or (at your option) any later version.
19 * Catacomb is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Library General Public License for more details.
24 * You should have received a copy of the GNU Library General Public
25 * License along with Catacomb; if not, write to the Free
26 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
30 /*----- Revision history --------------------------------------------------*
33 * Revision 1.1 2000/07/01 11:17:38 mdw
34 * New support for PKCS#1 message encoding.
38 #ifndef CATACOMB_PKCS1_H
39 #define CATACOMB_PKCS1_H
45 /*----- Header files ------------------------------------------------------*/
47 #include <mLib/bits.h>
48 #include <mLib/dstr.h>
50 #ifndef CATACOMB_GRAND_H
54 /*----- Data structures ---------------------------------------------------*/
56 typedef struct pkcs1
{
57 grand
*r
; /* Random number source */
58 const void *ep
; /* Encoding parameters block */
59 size_t epsz
; /* Size of the parameter block */
62 /*----- Functions provided ------------------------------------------------*/
64 /* --- @pkcs1_cryptencode@ --- *
66 * Arguments: @const void *msg@ = pointer to message data
67 * @size_t msz@ = size of message data
68 * @void *buf@ = pointer to output buffer
69 * @size_t sz@ = size of the output buffer
70 * @void *p@ = pointer to PKCS1 parameter block
72 * Returns: Zero if all went well, negative on failure.
74 * Use: Implements the operation @EME-PKCS1-V1_5-ENCODE@, as defined
75 * in PKCS#1 v. 2.0 (RFC2437).
78 extern int pkcs1_cryptencode(const void */
*msg*/
, size_t /*msz*/,
79 void */
*buf*/
, size_t /*sz*/, void */
*p*/
);
81 /* --- @pkcs1_cryptdecode@ --- *
83 * Arguments: @const void *buf@ = pointer to encoded buffer)
84 * @size_t sz@ = size of the encoded buffer
85 * @dstr *d@ = pointer to destination string
86 * @void *p@ = pointer to PKCS1 parameter block
88 * Returns: The length of the output string if successful, negative on
91 * Use: Implements the operation @EME-PKCS1-V1_5-DECODE@, as defined
92 * in PKCS#1 v. 2.0 (RFC2437).
95 extern int pkcs1_cryptdecode(const void */
*buf*/
, size_t /*sz*/,
96 dstr */
*d*/
, void */
*p*/
);
98 /* --- @pkcs1_sigencode@ --- *
100 * Arguments: @const void *msg@ = pointer to message data
101 * @size_t msz@ = size of message data
102 * @void *buf@ = pointer to output buffer
103 * @size_t sz@ = size of the output buffer
104 * @void *p@ = pointer to PKCS1 parameter block
106 * Returns: Zero if all went well, negative on failure.
108 * Use: Implements the operation @EMSA-PKCS1-V1_5-ENCODE@, as defined
109 * in PKCS#1 v. 2.0 (RFC2437).
112 extern int pkcs1_sigencode(const void */
*msg*/
, size_t /*msz*/,
113 void */
*buf*/
, size_t /*sz*/, void */
*p*/
);
115 /* --- @pkcs1_sigdecode@ --- *
117 * Arguments: @const void *buf@ = pointer to encoded buffer
118 * @size_t sz@ = size of the encoded buffer
119 * @dstr *d@ = pointer to destination string
120 * @void *p@ = pointer to PKCS1 parameter block
122 * Returns: The length of the output string if successful, negative on
125 * Use: Implements the operation @EMSA-PKCS1-V1_5-DECODE@, as defined
126 * in PKCS#1 v. 2.0 (RFC2437).
129 extern int pkcs1_sigdecode(const void */
*buf*/
, size_t /*sz*/,
130 dstr */
*d*/
, void */
*p*/
);
132 /*----- That's all, folks -------------------------------------------------*/