Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: mozilla/security/nss/lib/pkcs7/secmime.h

Issue 14249009: Change the NSS and NSPR source tree to the new directory structure to be (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/nss/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « mozilla/security/nss/lib/pkcs7/pkcs7t.h ('k') | mozilla/security/nss/lib/pkcs7/secmime.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 /*
6 * Header file for routines specific to S/MIME. Keep things that are pure
7 * pkcs7 out of here; this is for S/MIME policy, S/MIME interoperability, etc.
8 *
9 * $Id: secmime.h,v 1.3 2012/04/25 14:50:06 gerv%gerv.net Exp $
10 */
11
12 #ifndef _SECMIME_H_
13 #define _SECMIME_H_ 1
14
15 #include "secpkcs7.h"
16
17
18 /************************************************************************/
19 SEC_BEGIN_PROTOS
20
21 /*
22 * Initialize the local recording of the user S/MIME cipher preferences.
23 * This function is called once for each cipher, the order being
24 * important (first call records greatest preference, and so on).
25 * When finished, it is called with a "which" of CIPHER_FAMILID_MASK.
26 * If the function is called again after that, it is assumed that
27 * the preferences are being reset, and the old preferences are
28 * discarded.
29 *
30 * XXX This is for a particular user, and right now the storage is
31 * XXX local, static. The preference should be stored elsewhere to allow
32 * XXX for multiple uses of one library? How does SSL handle this;
33 * XXX it has something similar?
34 *
35 * - The "which" values are defined in ciferfam.h (the SMIME_* values,
36 * for example SMIME_DES_CBC_56).
37 * - If "on" is non-zero then the named cipher is enabled, otherwise
38 * it is disabled. (It is not necessary to call the function for
39 * ciphers that are disabled, however, as that is the default.)
40 *
41 * If the cipher preference is successfully recorded, SECSuccess
42 * is returned. Otherwise SECFailure is returned. The only errors
43 * are due to failure allocating memory or bad parameters/calls:
44 * SEC_ERROR_XXX ("which" is not in the S/MIME cipher family)
45 * SEC_ERROR_XXX (function is being called more times than there
46 * are known/expected ciphers)
47 */
48 extern SECStatus SECMIME_EnableCipher(long which, int on);
49
50 /*
51 * Initialize the local recording of the S/MIME policy.
52 * This function is called to enable/disable a particular cipher.
53 * (S/MIME encryption or decryption using a particular cipher is only
54 * allowed if that cipher is currently enabled.) At startup, all S/MIME
55 * ciphers are disabled. From that point, this function can be called
56 * to enable a cipher -- it is not necessary to call this to disable
57 * a cipher unless that cipher was previously, explicitly enabled via
58 * this function.
59 *
60 * XXX This is for a the current module, I think, so local, static storage
61 * XXX is okay. Is that correct, or could multiple uses of the same
62 * XXX library expect to operate under different policies?
63 *
64 * - The "which" values are defined in ciferfam.h (the SMIME_* values,
65 * for example SMIME_DES_CBC_56).
66 * - If "on" is non-zero then the named cipher is enabled, otherwise
67 * it is disabled.
68 *
69 * If the cipher is successfully enabled/disabled, SECSuccess is
70 * returned. Otherwise SECFailure is returned. The only errors
71 * are due to bad parameters:
72 * SEC_ERROR_XXX ("which" is not in the S/MIME cipher family)
73 * SEC_ERROR_XXX ("which" exceeds expected maximum cipher; this is
74 * really an internal error)
75 */
76 extern SECStatus SECMIME_SetPolicy(long which, int on);
77
78 /*
79 * Does the current policy allow S/MIME decryption of this particular
80 * algorithm and keysize?
81 */
82 extern PRBool SECMIME_DecryptionAllowed(SECAlgorithmID *algid, PK11SymKey *key);
83
84 /*
85 * Does the current policy allow *any* S/MIME encryption (or decryption)?
86 *
87 * This tells whether or not *any* S/MIME encryption can be done,
88 * according to policy. Callers may use this to do nicer user interface
89 * (say, greying out a checkbox so a user does not even try to encrypt
90 * a message when they are not allowed to) or for any reason they want
91 * to check whether S/MIME encryption (or decryption, for that matter)
92 * may be done.
93 *
94 * It takes no arguments. The return value is a simple boolean:
95 * PR_TRUE means encryption (or decryption) is *possible*
96 * (but may still fail due to other reasons, like because we cannot
97 * find all the necessary certs, etc.; PR_TRUE is *not* a guarantee)
98 * PR_FALSE means encryption (or decryption) is not permitted
99 *
100 * There are no errors from this routine.
101 */
102 extern PRBool SECMIME_EncryptionPossible(void);
103
104 /*
105 * Start an S/MIME encrypting context.
106 *
107 * "scert" is the cert for the sender. It will be checked for validity.
108 * "rcerts" are the certs for the recipients. They will also be checked.
109 *
110 * "certdb" is the cert database to use for verifying the certs.
111 * It can be NULL if a default database is available (like in the client).
112 *
113 * This function already does all of the stuff specific to S/MIME protocol
114 * and local policy; the return value just needs to be passed to
115 * SEC_PKCS7Encode() or to SEC_PKCS7EncoderStart() to create the encoded data,
116 * and finally to SEC_PKCS7DestroyContentInfo().
117 *
118 * An error results in a return value of NULL and an error set.
119 * (Retrieve specific errors via PORT_GetError()/XP_GetError().)
120 */
121 extern SEC_PKCS7ContentInfo *SECMIME_CreateEncrypted(CERTCertificate *scert,
122 CERTCertificate **rcerts,
123 CERTCertDBHandle *certdb,
124 SECKEYGetPasswordKey pwfn,
125 void *pwfn_arg);
126
127 /*
128 * Start an S/MIME signing context.
129 *
130 * "scert" is the cert that will be used to sign the data. It will be
131 * checked for validity.
132 *
133 * "certdb" is the cert database to use for verifying the cert.
134 * It can be NULL if a default database is available (like in the client).
135 *
136 * "digestalg" names the digest algorithm. (It should be SEC_OID_SHA1;
137 * XXX There should be SECMIME functions for hashing, or the hashing should
138 * be built into this interface, which we would like because we would
139 * support more smartcards that way, and then this argument should go away.)
140 *
141 * "digest" is the actual digest of the data. It must be provided in
142 * the case of detached data or NULL if the content will be included.
143 *
144 * This function already does all of the stuff specific to S/MIME protocol
145 * and local policy; the return value just needs to be passed to
146 * SEC_PKCS7Encode() or to SEC_PKCS7EncoderStart() to create the encoded data,
147 * and finally to SEC_PKCS7DestroyContentInfo().
148 *
149 * An error results in a return value of NULL and an error set.
150 * (Retrieve specific errors via PORT_GetError()/XP_GetError().)
151 */
152 extern SEC_PKCS7ContentInfo *SECMIME_CreateSigned(CERTCertificate *scert,
153 CERTCertificate *ecert,
154 CERTCertDBHandle *certdb,
155 SECOidTag digestalg,
156 SECItem *digest,
157 SECKEYGetPasswordKey pwfn,
158 void *pwfn_arg);
159
160 /************************************************************************/
161 SEC_END_PROTOS
162
163 #endif /* _SECMIME_H_ */
OLDNEW
« no previous file with comments | « mozilla/security/nss/lib/pkcs7/pkcs7t.h ('k') | mozilla/security/nss/lib/pkcs7/secmime.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698