7ed3e97d51b6ffe27fae12ca3a3150e9a113445c
[silc.git] / lib / silccrypt / pkcs1.h
1 /*
2
3   pkcs1.h
4
5   Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
6
7   Copyright (C) 2001 Pekka Riikonen
8
9   This program is free software; you can redistribute it and/or modify
10   it under the terms of the GNU General Public License as published by
11   the Free Software Foundation; either version 2 of the License, or
12   (at your option) any later version.
13   
14   This program is distributed in the hope that it will be useful,
15   but WITHOUT ANY WARRANTY; without even the implied warranty of
16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   GNU General Public License for more details.
18
19 */
20 #ifndef PKCS1_H
21 #define PKCS1_H
22
23 /* 
24    PKCS #1 RSA wrapper.
25
26    Heavily modified to work under SILC, code that is not needed in SILC has
27    been removed for good, and some code was fixed and changed.
28
29    For example, RSA_DecodeOneBlock was not used at all by Mozilla, however,
30    I took this code in to use after doing some fixing.  Also, OAEP is removed
31    totally for now.  I'm not sure whether OAEP could be used in the future
32    with SILC but not for now.
33
34    This file also implements partial SILC PKCS API for RSA with PKCS #1.
35    It is partial because all the other functions but encrypt, decrypt,
36    sign and verify are common.
37
38    Note:
39
40    The mandatory PKCS #1 implementation in SILC must be compliant to either
41    PKCS #1 version 1.5 or PKCS #1 version 2 with the following notes:
42    The signature encoding is always in same format as the encryption
43    encoding regardles of the PKCS #1 version.  The signature with
44    appendix (with hash algorithm OID in the data) must not be used
45    in the SILC.  Rationale for this is that there is no binding between
46    the PKCS #1 OIDs and the hash algorithms used in the SILC protocol.
47    Hence, the encoding is always in PKCS #1 version 1.5 format.
48
49    Any questions and comments regarding this modified version should be
50    sent to priikone@poseidon.pspt.fi.
51
52    References: ftp://ftp.rsasecurity.com/pub/pkcs/ascii/pkcs-1v2.asc,
53                ftp://ftp.rsasecurity.com/pub/pkcs/ascii/pkcs-1.asc,
54                and RFC 2437.
55 */
56
57 /*
58  * SILC PKCS API for PKCS #1
59  *
60  * Note all the other PKCS API functions are used from the rsa.c.
61  * See the definitions in rsa.c and in silcpkcs.c.
62  */
63
64 SILC_PKCS_API_ENCRYPT(pkcs1);
65 SILC_PKCS_API_DECRYPT(pkcs1);
66 SILC_PKCS_API_SIGN(pkcs1);
67 SILC_PKCS_API_VERIFY(pkcs1);
68
69 #endif