Bug 452390 Tracemonkey will crash if the compiler doesn't have FASTCALL r=danderson
[wine-gecko.git] / security / manager / ssl / src / nsNSSErrors.cpp
blob50d90e2cf07119102fb0aedc9b279f650cd0d1c6
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
16 * The Original Code is mozilla.org code.
18 * The Initial Developer of the Original Code is
19 * Red Hat, Inc.
20 * Portions created by the Initial Developer are Copyright (C) 2007
21 * the Initial Developer. All Rights Reserved.
23 * Contributor(s):
24 * Kai Engert <kengert@redhat.com>
26 * Alternatively, the contents of this file may be used under the terms of
27 * either the GNU General Public License Version 2 or later (the "GPL"), or
28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
38 * ***** END LICENSE BLOCK ***** */
40 #include "nsNSSComponent.h"
41 #include "secerr.h"
42 #include "sslerr.h"
44 const char *
45 nsNSSErrors::getDefaultErrorStringName(PRInt32 err)
47 const char *id_str = nsnull;
49 switch (err)
51 case SSL_ERROR_EXPORT_ONLY_SERVER: id_str = "SSL_ERROR_EXPORT_ONLY_SERVER"; break;
52 case SSL_ERROR_US_ONLY_SERVER: id_str = "SSL_ERROR_US_ONLY_SERVER"; break;
53 case SSL_ERROR_NO_CYPHER_OVERLAP: id_str = "SSL_ERROR_NO_CYPHER_OVERLAP"; break;
54 case SSL_ERROR_NO_CERTIFICATE: id_str = "SSL_ERROR_NO_CERTIFICATE"; break;
55 case SSL_ERROR_BAD_CERTIFICATE: id_str = "SSL_ERROR_BAD_CERTIFICATE"; break;
56 case SSL_ERROR_BAD_CLIENT: id_str = "SSL_ERROR_BAD_CLIENT"; break;
57 case SSL_ERROR_BAD_SERVER: id_str = "SSL_ERROR_BAD_SERVER"; break;
58 case SSL_ERROR_UNSUPPORTED_CERTIFICATE_TYPE: id_str = "SSL_ERROR_UNSUPPORTED_CERTIFICATE_TYPE"; break;
59 case SSL_ERROR_UNSUPPORTED_VERSION: id_str = "SSL_ERROR_UNSUPPORTED_VERSION"; break;
60 case SSL_ERROR_WRONG_CERTIFICATE: id_str = "SSL_ERROR_WRONG_CERTIFICATE"; break;
61 case SSL_ERROR_BAD_CERT_DOMAIN: id_str = "SSL_ERROR_BAD_CERT_DOMAIN"; break;
62 case SSL_ERROR_SSL2_DISABLED: id_str = "SSL_ERROR_SSL2_DISABLED"; break;
63 case SSL_ERROR_BAD_MAC_READ: id_str = "SSL_ERROR_BAD_MAC_READ"; break;
64 case SSL_ERROR_BAD_MAC_ALERT: id_str = "SSL_ERROR_BAD_MAC_ALERT"; break;
65 case SSL_ERROR_BAD_CERT_ALERT: id_str = "SSL_ERROR_BAD_CERT_ALERT"; break;
66 case SSL_ERROR_REVOKED_CERT_ALERT: id_str = "SSL_ERROR_REVOKED_CERT_ALERT"; break;
67 case SSL_ERROR_EXPIRED_CERT_ALERT: id_str = "SSL_ERROR_EXPIRED_CERT_ALERT"; break;
68 case SSL_ERROR_SSL_DISABLED: id_str = "SSL_ERROR_SSL_DISABLED"; break;
69 case SSL_ERROR_FORTEZZA_PQG: id_str = "SSL_ERROR_FORTEZZA_PQG"; break;
70 case SSL_ERROR_UNKNOWN_CIPHER_SUITE: id_str = "SSL_ERROR_UNKNOWN_CIPHER_SUITE"; break;
71 case SSL_ERROR_NO_CIPHERS_SUPPORTED: id_str = "SSL_ERROR_NO_CIPHERS_SUPPORTED"; break;
72 case SSL_ERROR_BAD_BLOCK_PADDING: id_str = "SSL_ERROR_BAD_BLOCK_PADDING"; break;
73 case SSL_ERROR_RX_RECORD_TOO_LONG: id_str = "SSL_ERROR_RX_RECORD_TOO_LONG"; break;
74 case SSL_ERROR_TX_RECORD_TOO_LONG: id_str = "SSL_ERROR_TX_RECORD_TOO_LONG"; break;
75 case SSL_ERROR_RX_MALFORMED_HELLO_REQUEST: id_str = "SSL_ERROR_RX_MALFORMED_HELLO_REQUEST"; break;
76 case SSL_ERROR_RX_MALFORMED_CLIENT_HELLO: id_str = "SSL_ERROR_RX_MALFORMED_CLIENT_HELLO"; break;
77 case SSL_ERROR_RX_MALFORMED_SERVER_HELLO: id_str = "SSL_ERROR_RX_MALFORMED_SERVER_HELLO"; break;
78 case SSL_ERROR_RX_MALFORMED_CERTIFICATE: id_str = "SSL_ERROR_RX_MALFORMED_CERTIFICATE"; break;
79 case SSL_ERROR_RX_MALFORMED_SERVER_KEY_EXCH: id_str = "SSL_ERROR_RX_MALFORMED_SERVER_KEY_EXCH"; break;
80 case SSL_ERROR_RX_MALFORMED_CERT_REQUEST: id_str = "SSL_ERROR_RX_MALFORMED_CERT_REQUEST"; break;
81 case SSL_ERROR_RX_MALFORMED_HELLO_DONE: id_str = "SSL_ERROR_RX_MALFORMED_HELLO_DONE"; break;
82 case SSL_ERROR_RX_MALFORMED_CERT_VERIFY: id_str = "SSL_ERROR_RX_MALFORMED_CERT_VERIFY"; break;
83 case SSL_ERROR_RX_MALFORMED_CLIENT_KEY_EXCH: id_str = "SSL_ERROR_RX_MALFORMED_CLIENT_KEY_EXCH"; break;
84 case SSL_ERROR_RX_MALFORMED_FINISHED: id_str = "SSL_ERROR_RX_MALFORMED_FINISHED"; break;
85 case SSL_ERROR_RX_MALFORMED_CHANGE_CIPHER: id_str = "SSL_ERROR_RX_MALFORMED_CHANGE_CIPHER"; break;
86 case SSL_ERROR_RX_MALFORMED_ALERT: id_str = "SSL_ERROR_RX_MALFORMED_ALERT"; break;
87 case SSL_ERROR_RX_MALFORMED_HANDSHAKE: id_str = "SSL_ERROR_RX_MALFORMED_HANDSHAKE"; break;
88 case SSL_ERROR_RX_MALFORMED_APPLICATION_DATA: id_str = "SSL_ERROR_RX_MALFORMED_APPLICATION_DATA"; break;
89 case SSL_ERROR_RX_UNEXPECTED_HELLO_REQUEST: id_str = "SSL_ERROR_RX_UNEXPECTED_HELLO_REQUEST"; break;
90 case SSL_ERROR_RX_UNEXPECTED_CLIENT_HELLO: id_str = "SSL_ERROR_RX_UNEXPECTED_CLIENT_HELLO"; break;
91 case SSL_ERROR_RX_UNEXPECTED_SERVER_HELLO: id_str = "SSL_ERROR_RX_UNEXPECTED_SERVER_HELLO"; break;
92 case SSL_ERROR_RX_UNEXPECTED_CERTIFICATE: id_str = "SSL_ERROR_RX_UNEXPECTED_CERTIFICATE"; break;
93 case SSL_ERROR_RX_UNEXPECTED_SERVER_KEY_EXCH: id_str = "SSL_ERROR_RX_UNEXPECTED_SERVER_KEY_EXCH"; break;
94 case SSL_ERROR_RX_UNEXPECTED_CERT_REQUEST: id_str = "SSL_ERROR_RX_UNEXPECTED_CERT_REQUEST"; break;
95 case SSL_ERROR_RX_UNEXPECTED_HELLO_DONE: id_str = "SSL_ERROR_RX_UNEXPECTED_HELLO_DONE"; break;
96 case SSL_ERROR_RX_UNEXPECTED_CERT_VERIFY: id_str = "SSL_ERROR_RX_UNEXPECTED_CERT_VERIFY"; break;
97 case SSL_ERROR_RX_UNEXPECTED_CLIENT_KEY_EXCH: id_str = "SSL_ERROR_RX_UNEXPECTED_CLIENT_KEY_EXCH"; break;
98 case SSL_ERROR_RX_UNEXPECTED_FINISHED: id_str = "SSL_ERROR_RX_UNEXPECTED_FINISHED"; break;
99 case SSL_ERROR_RX_UNEXPECTED_CHANGE_CIPHER: id_str = "SSL_ERROR_RX_UNEXPECTED_CHANGE_CIPHER"; break;
100 case SSL_ERROR_RX_UNEXPECTED_ALERT: id_str = "SSL_ERROR_RX_UNEXPECTED_ALERT"; break;
101 case SSL_ERROR_RX_UNEXPECTED_HANDSHAKE: id_str = "SSL_ERROR_RX_UNEXPECTED_HANDSHAKE"; break;
102 case SSL_ERROR_RX_UNEXPECTED_APPLICATION_DATA: id_str = "SSL_ERROR_RX_UNEXPECTED_APPLICATION_DATA"; break;
103 case SSL_ERROR_RX_UNKNOWN_RECORD_TYPE: id_str = "SSL_ERROR_RX_UNKNOWN_RECORD_TYPE"; break;
104 case SSL_ERROR_RX_UNKNOWN_HANDSHAKE: id_str = "SSL_ERROR_RX_UNKNOWN_HANDSHAKE"; break;
105 case SSL_ERROR_RX_UNKNOWN_ALERT: id_str = "SSL_ERROR_RX_UNKNOWN_ALERT"; break;
106 case SSL_ERROR_CLOSE_NOTIFY_ALERT: id_str = "SSL_ERROR_CLOSE_NOTIFY_ALERT"; break;
107 case SSL_ERROR_HANDSHAKE_UNEXPECTED_ALERT: id_str = "SSL_ERROR_HANDSHAKE_UNEXPECTED_ALERT"; break;
108 case SSL_ERROR_DECOMPRESSION_FAILURE_ALERT: id_str = "SSL_ERROR_DECOMPRESSION_FAILURE_ALERT"; break;
109 case SSL_ERROR_HANDSHAKE_FAILURE_ALERT: id_str = "SSL_ERROR_HANDSHAKE_FAILURE_ALERT"; break;
110 case SSL_ERROR_ILLEGAL_PARAMETER_ALERT: id_str = "SSL_ERROR_ILLEGAL_PARAMETER_ALERT"; break;
111 case SSL_ERROR_UNSUPPORTED_CERT_ALERT: id_str = "SSL_ERROR_UNSUPPORTED_CERT_ALERT"; break;
112 case SSL_ERROR_CERTIFICATE_UNKNOWN_ALERT: id_str = "SSL_ERROR_CERTIFICATE_UNKNOWN_ALERT"; break;
113 case SSL_ERROR_GENERATE_RANDOM_FAILURE: id_str = "SSL_ERROR_GENERATE_RANDOM_FAILURE"; break;
114 case SSL_ERROR_SIGN_HASHES_FAILURE: id_str = "SSL_ERROR_SIGN_HASHES_FAILURE"; break;
115 case SSL_ERROR_EXTRACT_PUBLIC_KEY_FAILURE: id_str = "SSL_ERROR_EXTRACT_PUBLIC_KEY_FAILURE"; break;
116 case SSL_ERROR_SERVER_KEY_EXCHANGE_FAILURE: id_str = "SSL_ERROR_SERVER_KEY_EXCHANGE_FAILURE"; break;
117 case SSL_ERROR_CLIENT_KEY_EXCHANGE_FAILURE: id_str = "SSL_ERROR_CLIENT_KEY_EXCHANGE_FAILURE"; break;
118 case SSL_ERROR_ENCRYPTION_FAILURE: id_str = "SSL_ERROR_ENCRYPTION_FAILURE"; break;
119 case SSL_ERROR_DECRYPTION_FAILURE: id_str = "SSL_ERROR_DECRYPTION_FAILURE"; break;
120 case SSL_ERROR_SOCKET_WRITE_FAILURE: id_str = "SSL_ERROR_SOCKET_WRITE_FAILURE"; break;
121 case SSL_ERROR_MD5_DIGEST_FAILURE: id_str = "SSL_ERROR_MD5_DIGEST_FAILURE"; break;
122 case SSL_ERROR_SHA_DIGEST_FAILURE: id_str = "SSL_ERROR_SHA_DIGEST_FAILURE"; break;
123 case SSL_ERROR_MAC_COMPUTATION_FAILURE: id_str = "SSL_ERROR_MAC_COMPUTATION_FAILURE"; break;
124 case SSL_ERROR_SYM_KEY_CONTEXT_FAILURE: id_str = "SSL_ERROR_SYM_KEY_CONTEXT_FAILURE"; break;
125 case SSL_ERROR_SYM_KEY_UNWRAP_FAILURE: id_str = "SSL_ERROR_SYM_KEY_UNWRAP_FAILURE"; break;
126 case SSL_ERROR_PUB_KEY_SIZE_LIMIT_EXCEEDED: id_str = "SSL_ERROR_PUB_KEY_SIZE_LIMIT_EXCEEDED"; break;
127 case SSL_ERROR_IV_PARAM_FAILURE: id_str = "SSL_ERROR_IV_PARAM_FAILURE"; break;
128 case SSL_ERROR_INIT_CIPHER_SUITE_FAILURE: id_str = "SSL_ERROR_INIT_CIPHER_SUITE_FAILURE"; break;
129 case SSL_ERROR_SESSION_KEY_GEN_FAILURE: id_str = "SSL_ERROR_SESSION_KEY_GEN_FAILURE"; break;
130 case SSL_ERROR_NO_SERVER_KEY_FOR_ALG: id_str = "SSL_ERROR_NO_SERVER_KEY_FOR_ALG"; break;
131 case SSL_ERROR_TOKEN_INSERTION_REMOVAL: id_str = "SSL_ERROR_TOKEN_INSERTION_REMOVAL"; break;
132 case SSL_ERROR_TOKEN_SLOT_NOT_FOUND: id_str = "SSL_ERROR_TOKEN_SLOT_NOT_FOUND"; break;
133 case SSL_ERROR_NO_COMPRESSION_OVERLAP: id_str = "SSL_ERROR_NO_COMPRESSION_OVERLAP"; break;
134 case SSL_ERROR_HANDSHAKE_NOT_COMPLETED: id_str = "SSL_ERROR_HANDSHAKE_NOT_COMPLETED"; break;
135 case SSL_ERROR_BAD_HANDSHAKE_HASH_VALUE: id_str = "SSL_ERROR_BAD_HANDSHAKE_HASH_VALUE"; break;
136 case SSL_ERROR_CERT_KEA_MISMATCH: id_str = "SSL_ERROR_CERT_KEA_MISMATCH"; break;
137 case SSL_ERROR_NO_TRUSTED_SSL_CLIENT_CA: id_str = "SSL_ERROR_NO_TRUSTED_SSL_CLIENT_CA"; break;
138 case SSL_ERROR_SESSION_NOT_FOUND: id_str = "SSL_ERROR_SESSION_NOT_FOUND"; break;
139 case SSL_ERROR_DECRYPTION_FAILED_ALERT: id_str = "SSL_ERROR_DECRYPTION_FAILED_ALERT"; break;
140 case SSL_ERROR_RECORD_OVERFLOW_ALERT: id_str = "SSL_ERROR_RECORD_OVERFLOW_ALERT"; break;
141 case SSL_ERROR_UNKNOWN_CA_ALERT: id_str = "SSL_ERROR_UNKNOWN_CA_ALERT"; break;
142 case SSL_ERROR_ACCESS_DENIED_ALERT: id_str = "SSL_ERROR_ACCESS_DENIED_ALERT"; break;
143 case SSL_ERROR_DECODE_ERROR_ALERT: id_str = "SSL_ERROR_DECODE_ERROR_ALERT"; break;
144 case SSL_ERROR_DECRYPT_ERROR_ALERT: id_str = "SSL_ERROR_DECRYPT_ERROR_ALERT"; break;
145 case SSL_ERROR_EXPORT_RESTRICTION_ALERT: id_str = "SSL_ERROR_EXPORT_RESTRICTION_ALERT"; break;
146 case SSL_ERROR_PROTOCOL_VERSION_ALERT: id_str = "SSL_ERROR_PROTOCOL_VERSION_ALERT"; break;
147 case SSL_ERROR_INSUFFICIENT_SECURITY_ALERT: id_str = "SSL_ERROR_INSUFFICIENT_SECURITY_ALERT"; break;
148 case SSL_ERROR_INTERNAL_ERROR_ALERT: id_str = "SSL_ERROR_INTERNAL_ERROR_ALERT"; break;
149 case SSL_ERROR_USER_CANCELED_ALERT: id_str = "SSL_ERROR_USER_CANCELED_ALERT"; break;
150 case SSL_ERROR_NO_RENEGOTIATION_ALERT: id_str = "SSL_ERROR_NO_RENEGOTIATION_ALERT"; break;
151 case SSL_ERROR_SERVER_CACHE_NOT_CONFIGURED: id_str = "SSL_ERROR_SERVER_CACHE_NOT_CONFIGURED"; break;
152 case SSL_ERROR_UNSUPPORTED_EXTENSION_ALERT: id_str = "SSL_ERROR_UNSUPPORTED_EXTENSION_ALERT"; break;
153 case SSL_ERROR_CERTIFICATE_UNOBTAINABLE_ALERT: id_str = "SSL_ERROR_CERTIFICATE_UNOBTAINABLE_ALERT"; break;
154 case SSL_ERROR_UNRECOGNIZED_NAME_ALERT: id_str = "SSL_ERROR_UNRECOGNIZED_NAME_ALERT"; break;
155 case SSL_ERROR_BAD_CERT_STATUS_RESPONSE_ALERT: id_str = "SSL_ERROR_BAD_CERT_STATUS_RESPONSE_ALERT"; break;
156 case SSL_ERROR_BAD_CERT_HASH_VALUE_ALERT: id_str = "SSL_ERROR_BAD_CERT_HASH_VALUE_ALERT"; break;
157 case SEC_ERROR_IO: id_str = "SEC_ERROR_IO"; break;
158 case SEC_ERROR_LIBRARY_FAILURE: id_str = "SEC_ERROR_LIBRARY_FAILURE"; break;
159 case SEC_ERROR_BAD_DATA: id_str = "SEC_ERROR_BAD_DATA"; break;
160 case SEC_ERROR_OUTPUT_LEN: id_str = "SEC_ERROR_OUTPUT_LEN"; break;
161 case SEC_ERROR_INPUT_LEN: id_str = "SEC_ERROR_INPUT_LEN"; break;
162 case SEC_ERROR_INVALID_ARGS: id_str = "SEC_ERROR_INVALID_ARGS"; break;
163 case SEC_ERROR_INVALID_ALGORITHM: id_str = "SEC_ERROR_INVALID_ALGORITHM"; break;
164 case SEC_ERROR_INVALID_AVA: id_str = "SEC_ERROR_INVALID_AVA"; break;
165 case SEC_ERROR_INVALID_TIME: id_str = "SEC_ERROR_INVALID_TIME"; break;
166 case SEC_ERROR_BAD_DER: id_str = "SEC_ERROR_BAD_DER"; break;
167 case SEC_ERROR_BAD_SIGNATURE: id_str = "SEC_ERROR_BAD_SIGNATURE"; break;
168 case SEC_ERROR_EXPIRED_CERTIFICATE: id_str = "SEC_ERROR_EXPIRED_CERTIFICATE"; break;
169 case SEC_ERROR_REVOKED_CERTIFICATE: id_str = "SEC_ERROR_REVOKED_CERTIFICATE"; break;
170 case SEC_ERROR_UNKNOWN_ISSUER: id_str = "SEC_ERROR_UNKNOWN_ISSUER"; break;
171 case SEC_ERROR_BAD_KEY: id_str = "SEC_ERROR_BAD_KEY"; break;
172 case SEC_ERROR_BAD_PASSWORD: id_str = "SEC_ERROR_BAD_PASSWORD"; break;
173 case SEC_ERROR_RETRY_PASSWORD: id_str = "SEC_ERROR_RETRY_PASSWORD"; break;
174 case SEC_ERROR_NO_NODELOCK: id_str = "SEC_ERROR_NO_NODELOCK"; break;
175 case SEC_ERROR_BAD_DATABASE: id_str = "SEC_ERROR_BAD_DATABASE"; break;
176 case SEC_ERROR_NO_MEMORY: id_str = "SEC_ERROR_NO_MEMORY"; break;
177 case SEC_ERROR_UNTRUSTED_ISSUER: id_str = "SEC_ERROR_UNTRUSTED_ISSUER"; break;
178 case SEC_ERROR_UNTRUSTED_CERT: id_str = "SEC_ERROR_UNTRUSTED_CERT"; break;
179 case SEC_ERROR_DUPLICATE_CERT: id_str = "SEC_ERROR_DUPLICATE_CERT"; break;
180 case SEC_ERROR_DUPLICATE_CERT_NAME: id_str = "SEC_ERROR_DUPLICATE_CERT_NAME"; break;
181 case SEC_ERROR_ADDING_CERT: id_str = "SEC_ERROR_ADDING_CERT"; break;
182 case SEC_ERROR_FILING_KEY: id_str = "SEC_ERROR_FILING_KEY"; break;
183 case SEC_ERROR_NO_KEY: id_str = "SEC_ERROR_NO_KEY"; break;
184 case SEC_ERROR_CERT_VALID: id_str = "SEC_ERROR_CERT_VALID"; break;
185 case SEC_ERROR_CERT_NOT_VALID: id_str = "SEC_ERROR_CERT_NOT_VALID"; break;
186 case SEC_ERROR_CERT_NO_RESPONSE: id_str = "SEC_ERROR_CERT_NO_RESPONSE"; break;
187 case SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE: id_str = "SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE"; break;
188 case SEC_ERROR_CRL_EXPIRED: id_str = "SEC_ERROR_CRL_EXPIRED"; break;
189 case SEC_ERROR_CRL_BAD_SIGNATURE: id_str = "SEC_ERROR_CRL_BAD_SIGNATURE"; break;
190 case SEC_ERROR_CRL_INVALID: id_str = "SEC_ERROR_CRL_INVALID"; break;
191 case SEC_ERROR_EXTENSION_VALUE_INVALID: id_str = "SEC_ERROR_EXTENSION_VALUE_INVALID"; break;
192 case SEC_ERROR_EXTENSION_NOT_FOUND: id_str = "SEC_ERROR_EXTENSION_NOT_FOUND"; break;
193 case SEC_ERROR_CA_CERT_INVALID: id_str = "SEC_ERROR_CA_CERT_INVALID"; break;
194 case SEC_ERROR_PATH_LEN_CONSTRAINT_INVALID: id_str = "SEC_ERROR_PATH_LEN_CONSTRAINT_INVALID"; break;
195 case SEC_ERROR_CERT_USAGES_INVALID: id_str = "SEC_ERROR_CERT_USAGES_INVALID"; break;
196 case SEC_INTERNAL_ONLY: id_str = "SEC_INTERNAL_ONLY"; break;
197 case SEC_ERROR_INVALID_KEY: id_str = "SEC_ERROR_INVALID_KEY"; break;
198 case SEC_ERROR_UNKNOWN_CRITICAL_EXTENSION: id_str = "SEC_ERROR_UNKNOWN_CRITICAL_EXTENSION"; break;
199 case SEC_ERROR_OLD_CRL: id_str = "SEC_ERROR_OLD_CRL"; break;
200 case SEC_ERROR_NO_EMAIL_CERT: id_str = "SEC_ERROR_NO_EMAIL_CERT"; break;
201 case SEC_ERROR_NO_RECIPIENT_CERTS_QUERY: id_str = "SEC_ERROR_NO_RECIPIENT_CERTS_QUERY"; break;
202 case SEC_ERROR_NOT_A_RECIPIENT: id_str = "SEC_ERROR_NOT_A_RECIPIENT"; break;
203 case SEC_ERROR_PKCS7_KEYALG_MISMATCH: id_str = "SEC_ERROR_PKCS7_KEYALG_MISMATCH"; break;
204 case SEC_ERROR_PKCS7_BAD_SIGNATURE: id_str = "SEC_ERROR_PKCS7_BAD_SIGNATURE"; break;
205 case SEC_ERROR_UNSUPPORTED_KEYALG: id_str = "SEC_ERROR_UNSUPPORTED_KEYALG"; break;
206 case SEC_ERROR_DECRYPTION_DISALLOWED: id_str = "SEC_ERROR_DECRYPTION_DISALLOWED"; break;
207 case XP_SEC_FORTEZZA_BAD_CARD: id_str = "XP_SEC_FORTEZZA_BAD_CARD"; break;
208 case XP_SEC_FORTEZZA_NO_CARD: id_str = "XP_SEC_FORTEZZA_NO_CARD"; break;
209 case XP_SEC_FORTEZZA_NONE_SELECTED: id_str = "XP_SEC_FORTEZZA_NONE_SELECTED"; break;
210 case XP_SEC_FORTEZZA_MORE_INFO: id_str = "XP_SEC_FORTEZZA_MORE_INFO"; break;
211 case XP_SEC_FORTEZZA_PERSON_NOT_FOUND: id_str = "XP_SEC_FORTEZZA_PERSON_NOT_FOUND"; break;
212 case XP_SEC_FORTEZZA_NO_MORE_INFO: id_str = "XP_SEC_FORTEZZA_NO_MORE_INFO"; break;
213 case XP_SEC_FORTEZZA_BAD_PIN: id_str = "XP_SEC_FORTEZZA_BAD_PIN"; break;
214 case XP_SEC_FORTEZZA_PERSON_ERROR: id_str = "XP_SEC_FORTEZZA_PERSON_ERROR"; break;
215 case SEC_ERROR_NO_KRL: id_str = "SEC_ERROR_NO_KRL"; break;
216 case SEC_ERROR_KRL_EXPIRED: id_str = "SEC_ERROR_KRL_EXPIRED"; break;
217 case SEC_ERROR_KRL_BAD_SIGNATURE: id_str = "SEC_ERROR_KRL_BAD_SIGNATURE"; break;
218 case SEC_ERROR_REVOKED_KEY: id_str = "SEC_ERROR_REVOKED_KEY"; break;
219 case SEC_ERROR_KRL_INVALID: id_str = "SEC_ERROR_KRL_INVALID"; break;
220 case SEC_ERROR_NEED_RANDOM: id_str = "SEC_ERROR_NEED_RANDOM"; break;
221 case SEC_ERROR_NO_MODULE: id_str = "SEC_ERROR_NO_MODULE"; break;
222 case SEC_ERROR_NO_TOKEN: id_str = "SEC_ERROR_NO_TOKEN"; break;
223 case SEC_ERROR_READ_ONLY: id_str = "SEC_ERROR_READ_ONLY"; break;
224 case SEC_ERROR_NO_SLOT_SELECTED: id_str = "SEC_ERROR_NO_SLOT_SELECTED"; break;
225 case SEC_ERROR_CERT_NICKNAME_COLLISION: id_str = "SEC_ERROR_CERT_NICKNAME_COLLISION"; break;
226 case SEC_ERROR_KEY_NICKNAME_COLLISION: id_str = "SEC_ERROR_KEY_NICKNAME_COLLISION"; break;
227 case SEC_ERROR_SAFE_NOT_CREATED: id_str = "SEC_ERROR_SAFE_NOT_CREATED"; break;
228 case SEC_ERROR_BAGGAGE_NOT_CREATED: id_str = "SEC_ERROR_BAGGAGE_NOT_CREATED"; break;
229 case XP_JAVA_REMOVE_PRINCIPAL_ERROR: id_str = "XP_JAVA_REMOVE_PRINCIPAL_ERROR"; break;
230 case XP_JAVA_DELETE_PRIVILEGE_ERROR: id_str = "XP_JAVA_DELETE_PRIVILEGE_ERROR"; break;
231 case XP_JAVA_CERT_NOT_EXISTS_ERROR: id_str = "XP_JAVA_CERT_NOT_EXISTS_ERROR"; break;
232 case SEC_ERROR_BAD_EXPORT_ALGORITHM: id_str = "SEC_ERROR_BAD_EXPORT_ALGORITHM"; break;
233 case SEC_ERROR_EXPORTING_CERTIFICATES: id_str = "SEC_ERROR_EXPORTING_CERTIFICATES"; break;
234 case SEC_ERROR_IMPORTING_CERTIFICATES: id_str = "SEC_ERROR_IMPORTING_CERTIFICATES"; break;
235 case SEC_ERROR_PKCS12_DECODING_PFX: id_str = "SEC_ERROR_PKCS12_DECODING_PFX"; break;
236 case SEC_ERROR_PKCS12_INVALID_MAC: id_str = "SEC_ERROR_PKCS12_INVALID_MAC"; break;
237 case SEC_ERROR_PKCS12_UNSUPPORTED_MAC_ALGORITHM: id_str = "SEC_ERROR_PKCS12_UNSUPPORTED_MAC_ALGORITHM"; break;
238 case SEC_ERROR_PKCS12_UNSUPPORTED_TRANSPORT_MODE: id_str = "SEC_ERROR_PKCS12_UNSUPPORTED_TRANSPORT_MODE"; break;
239 case SEC_ERROR_PKCS12_CORRUPT_PFX_STRUCTURE: id_str = "SEC_ERROR_PKCS12_CORRUPT_PFX_STRUCTURE"; break;
240 case SEC_ERROR_PKCS12_UNSUPPORTED_PBE_ALGORITHM: id_str = "SEC_ERROR_PKCS12_UNSUPPORTED_PBE_ALGORITHM"; break;
241 case SEC_ERROR_PKCS12_UNSUPPORTED_VERSION: id_str = "SEC_ERROR_PKCS12_UNSUPPORTED_VERSION"; break;
242 case SEC_ERROR_PKCS12_PRIVACY_PASSWORD_INCORRECT: id_str = "SEC_ERROR_PKCS12_PRIVACY_PASSWORD_INCORRECT"; break;
243 case SEC_ERROR_PKCS12_CERT_COLLISION: id_str = "SEC_ERROR_PKCS12_CERT_COLLISION"; break;
244 case SEC_ERROR_USER_CANCELLED: id_str = "SEC_ERROR_USER_CANCELLED"; break;
245 case SEC_ERROR_PKCS12_DUPLICATE_DATA: id_str = "SEC_ERROR_PKCS12_DUPLICATE_DATA"; break;
246 case SEC_ERROR_MESSAGE_SEND_ABORTED: id_str = "SEC_ERROR_MESSAGE_SEND_ABORTED"; break;
247 case SEC_ERROR_INADEQUATE_KEY_USAGE: id_str = "SEC_ERROR_INADEQUATE_KEY_USAGE"; break;
248 case SEC_ERROR_INADEQUATE_CERT_TYPE: id_str = "SEC_ERROR_INADEQUATE_CERT_TYPE"; break;
249 case SEC_ERROR_CERT_ADDR_MISMATCH: id_str = "SEC_ERROR_CERT_ADDR_MISMATCH"; break;
250 case SEC_ERROR_PKCS12_UNABLE_TO_IMPORT_KEY: id_str = "SEC_ERROR_PKCS12_UNABLE_TO_IMPORT_KEY"; break;
251 case SEC_ERROR_PKCS12_IMPORTING_CERT_CHAIN: id_str = "SEC_ERROR_PKCS12_IMPORTING_CERT_CHAIN"; break;
252 case SEC_ERROR_PKCS12_UNABLE_TO_LOCATE_OBJECT_BY_NAME: id_str = "SEC_ERROR_PKCS12_UNABLE_TO_LOCATE_OBJECT_BY_NAME"; break;
253 case SEC_ERROR_PKCS12_UNABLE_TO_EXPORT_KEY: id_str = "SEC_ERROR_PKCS12_UNABLE_TO_EXPORT_KEY"; break;
254 case SEC_ERROR_PKCS12_UNABLE_TO_WRITE: id_str = "SEC_ERROR_PKCS12_UNABLE_TO_WRITE"; break;
255 case SEC_ERROR_PKCS12_UNABLE_TO_READ: id_str = "SEC_ERROR_PKCS12_UNABLE_TO_READ"; break;
256 case SEC_ERROR_PKCS12_KEY_DATABASE_NOT_INITIALIZED: id_str = "SEC_ERROR_PKCS12_KEY_DATABASE_NOT_INITIALIZED"; break;
257 case SEC_ERROR_KEYGEN_FAIL: id_str = "SEC_ERROR_KEYGEN_FAIL"; break;
258 case SEC_ERROR_INVALID_PASSWORD: id_str = "SEC_ERROR_INVALID_PASSWORD"; break;
259 case SEC_ERROR_RETRY_OLD_PASSWORD: id_str = "SEC_ERROR_RETRY_OLD_PASSWORD"; break;
260 case SEC_ERROR_BAD_NICKNAME: id_str = "SEC_ERROR_BAD_NICKNAME"; break;
261 case SEC_ERROR_NOT_FORTEZZA_ISSUER: id_str = "SEC_ERROR_NOT_FORTEZZA_ISSUER"; break;
262 case SEC_ERROR_CANNOT_MOVE_SENSITIVE_KEY: id_str = "SEC_ERROR_CANNOT_MOVE_SENSITIVE_KEY"; break;
263 case SEC_ERROR_JS_INVALID_MODULE_NAME: id_str = "SEC_ERROR_JS_INVALID_MODULE_NAME"; break;
264 case SEC_ERROR_JS_INVALID_DLL: id_str = "SEC_ERROR_JS_INVALID_DLL"; break;
265 case SEC_ERROR_JS_ADD_MOD_FAILURE: id_str = "SEC_ERROR_JS_ADD_MOD_FAILURE"; break;
266 case SEC_ERROR_JS_DEL_MOD_FAILURE: id_str = "SEC_ERROR_JS_DEL_MOD_FAILURE"; break;
267 case SEC_ERROR_OLD_KRL: id_str = "SEC_ERROR_OLD_KRL"; break;
268 case SEC_ERROR_CKL_CONFLICT: id_str = "SEC_ERROR_CKL_CONFLICT"; break;
269 case SEC_ERROR_CERT_NOT_IN_NAME_SPACE: id_str = "SEC_ERROR_CERT_NOT_IN_NAME_SPACE"; break;
270 case SEC_ERROR_KRL_NOT_YET_VALID: id_str = "SEC_ERROR_KRL_NOT_YET_VALID"; break;
271 case SEC_ERROR_CRL_NOT_YET_VALID: id_str = "SEC_ERROR_CRL_NOT_YET_VALID"; break;
272 case SEC_ERROR_UNKNOWN_CERT: id_str = "SEC_ERROR_UNKNOWN_CERT"; break;
273 case SEC_ERROR_UNKNOWN_SIGNER: id_str = "SEC_ERROR_UNKNOWN_SIGNER"; break;
274 case SEC_ERROR_CERT_BAD_ACCESS_LOCATION: id_str = "SEC_ERROR_CERT_BAD_ACCESS_LOCATION"; break;
275 case SEC_ERROR_OCSP_UNKNOWN_RESPONSE_TYPE: id_str = "SEC_ERROR_OCSP_UNKNOWN_RESPONSE_TYPE"; break;
276 case SEC_ERROR_OCSP_BAD_HTTP_RESPONSE: id_str = "SEC_ERROR_OCSP_BAD_HTTP_RESPONSE"; break;
277 case SEC_ERROR_OCSP_MALFORMED_REQUEST: id_str = "SEC_ERROR_OCSP_MALFORMED_REQUEST"; break;
278 case SEC_ERROR_OCSP_SERVER_ERROR: id_str = "SEC_ERROR_OCSP_SERVER_ERROR"; break;
279 case SEC_ERROR_OCSP_TRY_SERVER_LATER: id_str = "SEC_ERROR_OCSP_TRY_SERVER_LATER"; break;
280 case SEC_ERROR_OCSP_REQUEST_NEEDS_SIG: id_str = "SEC_ERROR_OCSP_REQUEST_NEEDS_SIG"; break;
281 case SEC_ERROR_OCSP_UNAUTHORIZED_REQUEST: id_str = "SEC_ERROR_OCSP_UNAUTHORIZED_REQUEST"; break;
282 case SEC_ERROR_OCSP_UNKNOWN_RESPONSE_STATUS: id_str = "SEC_ERROR_OCSP_UNKNOWN_RESPONSE_STATUS"; break;
283 case SEC_ERROR_OCSP_UNKNOWN_CERT: id_str = "SEC_ERROR_OCSP_UNKNOWN_CERT"; break;
284 case SEC_ERROR_OCSP_NOT_ENABLED: id_str = "SEC_ERROR_OCSP_NOT_ENABLED"; break;
285 case SEC_ERROR_OCSP_NO_DEFAULT_RESPONDER: id_str = "SEC_ERROR_OCSP_NO_DEFAULT_RESPONDER"; break;
286 case SEC_ERROR_OCSP_MALFORMED_RESPONSE: id_str = "SEC_ERROR_OCSP_MALFORMED_RESPONSE"; break;
287 case SEC_ERROR_OCSP_UNAUTHORIZED_RESPONSE: id_str = "SEC_ERROR_OCSP_UNAUTHORIZED_RESPONSE"; break;
288 case SEC_ERROR_OCSP_FUTURE_RESPONSE: id_str = "SEC_ERROR_OCSP_FUTURE_RESPONSE"; break;
289 case SEC_ERROR_OCSP_OLD_RESPONSE: id_str = "SEC_ERROR_OCSP_OLD_RESPONSE"; break;
290 case SEC_ERROR_DIGEST_NOT_FOUND: id_str = "SEC_ERROR_DIGEST_NOT_FOUND"; break;
291 case SEC_ERROR_UNSUPPORTED_MESSAGE_TYPE: id_str = "SEC_ERROR_UNSUPPORTED_MESSAGE_TYPE"; break;
292 case SEC_ERROR_MODULE_STUCK: id_str = "SEC_ERROR_MODULE_STUCK"; break;
293 case SEC_ERROR_BAD_TEMPLATE: id_str = "SEC_ERROR_BAD_TEMPLATE"; break;
294 case SEC_ERROR_CRL_NOT_FOUND: id_str = "SEC_ERROR_CRL_NOT_FOUND"; break;
295 case SEC_ERROR_REUSED_ISSUER_AND_SERIAL: id_str = "SEC_ERROR_REUSED_ISSUER_AND_SERIAL"; break;
296 case SEC_ERROR_BUSY: id_str = "SEC_ERROR_BUSY"; break;
297 case SEC_ERROR_EXTRA_INPUT: id_str = "SEC_ERROR_EXTRA_INPUT"; break;
298 case SEC_ERROR_UNSUPPORTED_ELLIPTIC_CURVE: id_str = "SEC_ERROR_UNSUPPORTED_ELLIPTIC_CURVE"; break;
299 case SEC_ERROR_UNSUPPORTED_EC_POINT_FORM: id_str = "SEC_ERROR_UNSUPPORTED_EC_POINT_FORM"; break;
300 case SEC_ERROR_UNRECOGNIZED_OID: id_str = "SEC_ERROR_UNRECOGNIZED_OID"; break;
301 case SEC_ERROR_OCSP_INVALID_SIGNING_CERT: id_str = "SEC_ERROR_OCSP_INVALID_SIGNING_CERT"; break;
302 case SEC_ERROR_REVOKED_CERTIFICATE_CRL: id_str = "SEC_ERROR_REVOKED_CERTIFICATE_CRL"; break;
303 case SEC_ERROR_REVOKED_CERTIFICATE_OCSP: id_str = "SEC_ERROR_REVOKED_CERTIFICATE_OCSP"; break;
304 case SEC_ERROR_CRL_INVALID_VERSION: id_str = "SEC_ERROR_CRL_INVALID_VERSION"; break;
305 case SEC_ERROR_CRL_V1_CRITICAL_EXTENSION: id_str = "SEC_ERROR_CRL_V1_CRITICAL_EXTENSION"; break;
306 case SEC_ERROR_CRL_UNKNOWN_CRITICAL_EXTENSION: id_str = "SEC_ERROR_CRL_UNKNOWN_CRITICAL_EXTENSION"; break;
307 case SEC_ERROR_UNKNOWN_OBJECT_TYPE: id_str = "SEC_ERROR_UNKNOWN_OBJECT_TYPE"; break;
308 case SEC_ERROR_INCOMPATIBLE_PKCS11: id_str = "SEC_ERROR_INCOMPATIBLE_PKCS11"; break;
309 case SEC_ERROR_NO_EVENT: id_str = "SEC_ERROR_NO_EVENT"; break;
310 case SEC_ERROR_CRL_ALREADY_EXISTS: id_str = "SEC_ERROR_CRL_ALREADY_EXISTS"; break;
311 case SEC_ERROR_NOT_INITIALIZED: id_str = "SEC_ERROR_NOT_INITIALIZED"; break;
312 case SEC_ERROR_TOKEN_NOT_LOGGED_IN: id_str = "SEC_ERROR_TOKEN_NOT_LOGGED_IN"; break;
313 case SEC_ERROR_OCSP_RESPONDER_CERT_INVALID: id_str = "SEC_ERROR_OCSP_RESPONDER_CERT_INVALID"; break;
314 case SEC_ERROR_OCSP_BAD_SIGNATURE: id_str = "SEC_ERROR_OCSP_BAD_SIGNATURE"; break;
317 return id_str;
320 const char *
321 nsNSSErrors::getOverrideErrorStringName(PRInt32 aErrorCode)
323 const char *id_str = nsnull;
325 switch (aErrorCode) {
326 case SSL_ERROR_SSL_DISABLED:
327 id_str = "PSMERR_SSL_Disabled";
328 break;
330 case SSL_ERROR_SSL2_DISABLED:
331 id_str = "PSMERR_SSL2_Disabled";
332 break;
334 case SEC_ERROR_REUSED_ISSUER_AND_SERIAL:
335 id_str = "PSMERR_HostReusedIssuerSerial";
336 break;
339 return id_str;
342 nsresult
343 nsNSSErrors::getErrorMessageFromCode(PRInt32 err,
344 nsINSSComponent *component,
345 nsString &returnedMessage)
347 NS_ENSURE_ARG_POINTER(component);
348 returnedMessage.Truncate();
350 const char *nss_error_id_str = getDefaultErrorStringName(err);
351 const char *id_str = getOverrideErrorStringName(err);
353 if (id_str || nss_error_id_str)
355 nsString defMsg;
356 nsresult rv;
357 if (id_str)
359 rv = component->GetPIPNSSBundleString(id_str, defMsg);
361 else
363 rv = component->GetNSSBundleString(nss_error_id_str, defMsg);
366 if (NS_SUCCEEDED(rv))
368 returnedMessage.Append(defMsg);
369 returnedMessage.Append(NS_LITERAL_STRING("\n"));
372 nsCString error_id(nss_error_id_str);
373 ToLowerCase(error_id);
374 NS_ConvertASCIItoUTF16 idU(error_id);
376 const PRUnichar *params[1];
377 params[0] = idU.get();
379 nsString formattedString;
380 rv = component->PIPBundleFormatStringFromName("certErrorCodePrefix",
381 params, 1,
382 formattedString);
383 if (NS_SUCCEEDED(rv)) {
384 returnedMessage.Append(NS_LITERAL_STRING("\n"));
385 returnedMessage.Append(formattedString);
386 returnedMessage.Append(NS_LITERAL_STRING("\n"));
388 else {
389 returnedMessage.Append(NS_LITERAL_STRING("("));
390 returnedMessage.Append(idU);
391 returnedMessage.Append(NS_LITERAL_STRING(")"));
395 return NS_OK;