1/* 2 * The contents of this file are subject to the Mozilla Public 3 * License Version 1.1 (the "License"); you may not use this file 4 * except in compliance with the License. You may obtain a copy of 5 * the License at http://www.mozilla.org/MPL/ 6 * 7 * Software distributed under the License is distributed on an "AS 8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or 9 * implied. See the License for the specific language governing 10 * rights and limitations under the License. 11 * 12 * The Original Code is the Netscape security libraries. 13 * 14 * The Initial Developer of the Original Code is Netscape 15 * Communications Corporation. Portions created by Netscape are 16 * Copyright (C) 1994-2000 Netscape Communications Corporation. All 17 * Rights Reserved. 18 * 19 * Contributor(s): 20 * 21 * Alternatively, the contents of this file may be used under the 22 * terms of the GNU General Public License Version 2 or later (the 23 * "GPL"), in which case the provisions of the GPL are applicable 24 * instead of those above. If you wish to allow use of your 25 * version of this file only under the terms of the GPL and not to 26 * allow others to use your version of this file under the MPL, 27 * indicate your decision by deleting the provisions above and 28 * replace them with the notice and other provisions required by 29 * the GPL. If you do not delete the provisions above, a recipient 30 * may use your version of this file under either the MPL or the 31 * GPL. 32 */ 33 34#ifndef __SEC_ERR_H_ 35#define __SEC_ERR_H_ 36 37#include <security_asn1/prerror.h> 38 39PR_BEGIN_EXTERN_C 40 41#define SEC_ERROR_BASE (-0x2000) 42#define SEC_ERROR_LIMIT (SEC_ERROR_BASE + 1000) 43 44#define IS_SEC_ERROR(code) \ 45 (((code) >= SEC_ERROR_BASE) && ((code) < SEC_ERROR_LIMIT)) 46 47#ifndef NO_SECURITY_ERROR_ENUM 48typedef enum { 49SEC_ERROR_IO = SEC_ERROR_BASE + 0, 50SEC_ERROR_LIBRARY_FAILURE = SEC_ERROR_BASE + 1, 51SEC_ERROR_BAD_DATA = SEC_ERROR_BASE + 2, 52SEC_ERROR_OUTPUT_LEN = SEC_ERROR_BASE + 3, 53SEC_ERROR_INPUT_LEN = SEC_ERROR_BASE + 4, 54SEC_ERROR_INVALID_ARGS = SEC_ERROR_BASE + 5, 55SEC_ERROR_INVALID_ALGORITHM = SEC_ERROR_BASE + 6, 56SEC_ERROR_INVALID_AVA = SEC_ERROR_BASE + 7, 57SEC_ERROR_INVALID_TIME = SEC_ERROR_BASE + 8, 58SEC_ERROR_BAD_DER = SEC_ERROR_BASE + 9, 59SEC_ERROR_BAD_SIGNATURE = SEC_ERROR_BASE + 10, 60SEC_ERROR_EXPIRED_CERTIFICATE = SEC_ERROR_BASE + 11, 61SEC_ERROR_REVOKED_CERTIFICATE = SEC_ERROR_BASE + 12, 62SEC_ERROR_UNKNOWN_ISSUER = SEC_ERROR_BASE + 13, 63SEC_ERROR_BAD_KEY = SEC_ERROR_BASE + 14, 64SEC_ERROR_BAD_PASSWORD = SEC_ERROR_BASE + 15, 65SEC_ERROR_RETRY_PASSWORD = SEC_ERROR_BASE + 16, 66SEC_ERROR_NO_NODELOCK = SEC_ERROR_BASE + 17, 67SEC_ERROR_BAD_DATABASE = SEC_ERROR_BASE + 18, 68SEC_ERROR_NO_MEMORY = SEC_ERROR_BASE + 19, 69SEC_ERROR_UNTRUSTED_ISSUER = SEC_ERROR_BASE + 20, 70SEC_ERROR_UNTRUSTED_CERT = SEC_ERROR_BASE + 21, 71SEC_ERROR_DUPLICATE_CERT = (SEC_ERROR_BASE + 22), 72SEC_ERROR_DUPLICATE_CERT_NAME = (SEC_ERROR_BASE + 23), 73SEC_ERROR_ADDING_CERT = (SEC_ERROR_BASE + 24), 74SEC_ERROR_FILING_KEY = (SEC_ERROR_BASE + 25), 75SEC_ERROR_NO_KEY = (SEC_ERROR_BASE + 26), 76SEC_ERROR_CERT_VALID = (SEC_ERROR_BASE + 27), 77SEC_ERROR_CERT_NOT_VALID = (SEC_ERROR_BASE + 28), 78SEC_ERROR_CERT_NO_RESPONSE = (SEC_ERROR_BASE + 29), 79SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE = (SEC_ERROR_BASE + 30), 80SEC_ERROR_CRL_EXPIRED = (SEC_ERROR_BASE + 31), 81SEC_ERROR_CRL_BAD_SIGNATURE = (SEC_ERROR_BASE + 32), 82SEC_ERROR_CRL_INVALID = (SEC_ERROR_BASE + 33), 83SEC_ERROR_EXTENSION_VALUE_INVALID = (SEC_ERROR_BASE + 34), 84SEC_ERROR_EXTENSION_NOT_FOUND = (SEC_ERROR_BASE + 35), 85SEC_ERROR_CA_CERT_INVALID = (SEC_ERROR_BASE + 36), 86SEC_ERROR_PATH_LEN_CONSTRAINT_INVALID = (SEC_ERROR_BASE + 37), 87SEC_ERROR_CERT_USAGES_INVALID = (SEC_ERROR_BASE + 38), 88SEC_INTERNAL_ONLY = (SEC_ERROR_BASE + 39), 89SEC_ERROR_INVALID_KEY = (SEC_ERROR_BASE + 40), 90SEC_ERROR_UNKNOWN_CRITICAL_EXTENSION = (SEC_ERROR_BASE + 41), 91SEC_ERROR_OLD_CRL = (SEC_ERROR_BASE + 42), 92SEC_ERROR_NO_EMAIL_CERT = (SEC_ERROR_BASE + 43), 93SEC_ERROR_NO_RECIPIENT_CERTS_QUERY = (SEC_ERROR_BASE + 44), 94SEC_ERROR_NOT_A_RECIPIENT = (SEC_ERROR_BASE + 45), 95SEC_ERROR_PKCS7_KEYALG_MISMATCH = (SEC_ERROR_BASE + 46), 96SEC_ERROR_PKCS7_BAD_SIGNATURE = (SEC_ERROR_BASE + 47), 97SEC_ERROR_UNSUPPORTED_KEYALG = (SEC_ERROR_BASE + 48), 98SEC_ERROR_DECRYPTION_DISALLOWED = (SEC_ERROR_BASE + 49), 99/* Fortezza Alerts */ 100XP_SEC_FORTEZZA_BAD_CARD = (SEC_ERROR_BASE + 50), 101XP_SEC_FORTEZZA_NO_CARD = (SEC_ERROR_BASE + 51), 102XP_SEC_FORTEZZA_NONE_SELECTED = (SEC_ERROR_BASE + 52), 103XP_SEC_FORTEZZA_MORE_INFO = (SEC_ERROR_BASE + 53), 104XP_SEC_FORTEZZA_PERSON_NOT_FOUND = (SEC_ERROR_BASE + 54), 105XP_SEC_FORTEZZA_NO_MORE_INFO = (SEC_ERROR_BASE + 55), 106XP_SEC_FORTEZZA_BAD_PIN = (SEC_ERROR_BASE + 56), 107XP_SEC_FORTEZZA_PERSON_ERROR = (SEC_ERROR_BASE + 57), 108SEC_ERROR_NO_KRL = (SEC_ERROR_BASE + 58), 109SEC_ERROR_KRL_EXPIRED = (SEC_ERROR_BASE + 59), 110SEC_ERROR_KRL_BAD_SIGNATURE = (SEC_ERROR_BASE + 60), 111SEC_ERROR_REVOKED_KEY = (SEC_ERROR_BASE + 61), 112SEC_ERROR_KRL_INVALID = (SEC_ERROR_BASE + 62), 113SEC_ERROR_NEED_RANDOM = (SEC_ERROR_BASE + 63), 114SEC_ERROR_NO_MODULE = (SEC_ERROR_BASE + 64), 115SEC_ERROR_NO_TOKEN = (SEC_ERROR_BASE + 65), 116SEC_ERROR_READ_ONLY = (SEC_ERROR_BASE + 66), 117SEC_ERROR_NO_SLOT_SELECTED = (SEC_ERROR_BASE + 67), 118SEC_ERROR_CERT_NICKNAME_COLLISION = (SEC_ERROR_BASE + 68), 119SEC_ERROR_KEY_NICKNAME_COLLISION = (SEC_ERROR_BASE + 69), 120SEC_ERROR_SAFE_NOT_CREATED = (SEC_ERROR_BASE + 70), 121SEC_ERROR_BAGGAGE_NOT_CREATED = (SEC_ERROR_BASE + 71), 122XP_JAVA_REMOVE_PRINCIPAL_ERROR = (SEC_ERROR_BASE + 72), 123XP_JAVA_DELETE_PRIVILEGE_ERROR = (SEC_ERROR_BASE + 73), 124XP_JAVA_CERT_NOT_EXISTS_ERROR = (SEC_ERROR_BASE + 74), 125SEC_ERROR_BAD_EXPORT_ALGORITHM = (SEC_ERROR_BASE + 75), 126SEC_ERROR_EXPORTING_CERTIFICATES = (SEC_ERROR_BASE + 76), 127SEC_ERROR_IMPORTING_CERTIFICATES = (SEC_ERROR_BASE + 77), 128SEC_ERROR_PKCS12_DECODING_PFX = (SEC_ERROR_BASE + 78), 129SEC_ERROR_PKCS12_INVALID_MAC = (SEC_ERROR_BASE + 79), 130SEC_ERROR_PKCS12_UNSUPPORTED_MAC_ALGORITHM = (SEC_ERROR_BASE + 80), 131SEC_ERROR_PKCS12_UNSUPPORTED_TRANSPORT_MODE = (SEC_ERROR_BASE + 81), 132SEC_ERROR_PKCS12_CORRUPT_PFX_STRUCTURE = (SEC_ERROR_BASE + 82), 133SEC_ERROR_PKCS12_UNSUPPORTED_PBE_ALGORITHM = (SEC_ERROR_BASE + 83), 134SEC_ERROR_PKCS12_UNSUPPORTED_VERSION = (SEC_ERROR_BASE + 84), 135SEC_ERROR_PKCS12_PRIVACY_PASSWORD_INCORRECT = (SEC_ERROR_BASE + 85), 136SEC_ERROR_PKCS12_CERT_COLLISION = (SEC_ERROR_BASE + 86), 137SEC_ERROR_USER_CANCELLED = (SEC_ERROR_BASE + 87), 138SEC_ERROR_PKCS12_DUPLICATE_DATA = (SEC_ERROR_BASE + 88), 139SEC_ERROR_MESSAGE_SEND_ABORTED = (SEC_ERROR_BASE + 89), 140SEC_ERROR_INADEQUATE_KEY_USAGE = (SEC_ERROR_BASE + 90), 141SEC_ERROR_INADEQUATE_CERT_TYPE = (SEC_ERROR_BASE + 91), 142SEC_ERROR_CERT_ADDR_MISMATCH = (SEC_ERROR_BASE + 92), 143SEC_ERROR_PKCS12_UNABLE_TO_IMPORT_KEY = (SEC_ERROR_BASE + 93), 144SEC_ERROR_PKCS12_IMPORTING_CERT_CHAIN = (SEC_ERROR_BASE + 94), 145SEC_ERROR_PKCS12_UNABLE_TO_LOCATE_OBJECT_BY_NAME = (SEC_ERROR_BASE + 95), 146SEC_ERROR_PKCS12_UNABLE_TO_EXPORT_KEY = (SEC_ERROR_BASE + 96), 147SEC_ERROR_PKCS12_UNABLE_TO_WRITE = (SEC_ERROR_BASE + 97), 148SEC_ERROR_PKCS12_UNABLE_TO_READ = (SEC_ERROR_BASE + 98), 149SEC_ERROR_PKCS12_KEY_DATABASE_NOT_INITIALIZED = (SEC_ERROR_BASE + 99), 150SEC_ERROR_KEYGEN_FAIL = (SEC_ERROR_BASE + 100), 151SEC_ERROR_INVALID_PASSWORD = (SEC_ERROR_BASE + 101), 152SEC_ERROR_RETRY_OLD_PASSWORD = (SEC_ERROR_BASE + 102), 153SEC_ERROR_BAD_NICKNAME = (SEC_ERROR_BASE + 103), 154SEC_ERROR_NOT_FORTEZZA_ISSUER = (SEC_ERROR_BASE + 104), 155SEC_ERROR_CANNOT_MOVE_SENSITIVE_KEY = (SEC_ERROR_BASE + 105), 156SEC_ERROR_JS_INVALID_MODULE_NAME = (SEC_ERROR_BASE + 106), 157SEC_ERROR_JS_INVALID_DLL = (SEC_ERROR_BASE + 107), 158SEC_ERROR_JS_ADD_MOD_FAILURE = (SEC_ERROR_BASE + 108), 159SEC_ERROR_JS_DEL_MOD_FAILURE = (SEC_ERROR_BASE + 109), 160SEC_ERROR_OLD_KRL = (SEC_ERROR_BASE + 110), 161SEC_ERROR_CKL_CONFLICT = (SEC_ERROR_BASE + 111), 162SEC_ERROR_CERT_NOT_IN_NAME_SPACE = (SEC_ERROR_BASE + 112), 163SEC_ERROR_KRL_NOT_YET_VALID = (SEC_ERROR_BASE + 113), 164SEC_ERROR_CRL_NOT_YET_VALID = (SEC_ERROR_BASE + 114), 165SEC_ERROR_UNKNOWN_CERT = (SEC_ERROR_BASE + 115), 166SEC_ERROR_UNKNOWN_SIGNER = (SEC_ERROR_BASE + 116), 167SEC_ERROR_CERT_BAD_ACCESS_LOCATION = (SEC_ERROR_BASE + 117), 168SEC_ERROR_OCSP_UNKNOWN_RESPONSE_TYPE = (SEC_ERROR_BASE + 118), 169SEC_ERROR_OCSP_BAD_HTTP_RESPONSE = (SEC_ERROR_BASE + 119), 170SEC_ERROR_OCSP_MALFORMED_REQUEST = (SEC_ERROR_BASE + 120), 171SEC_ERROR_OCSP_SERVER_ERROR = (SEC_ERROR_BASE + 121), 172SEC_ERROR_OCSP_TRY_SERVER_LATER = (SEC_ERROR_BASE + 122), 173SEC_ERROR_OCSP_REQUEST_NEEDS_SIG = (SEC_ERROR_BASE + 123), 174SEC_ERROR_OCSP_UNAUTHORIZED_REQUEST = (SEC_ERROR_BASE + 124), 175SEC_ERROR_OCSP_UNKNOWN_RESPONSE_STATUS = (SEC_ERROR_BASE + 125), 176SEC_ERROR_OCSP_UNKNOWN_CERT = (SEC_ERROR_BASE + 126), 177SEC_ERROR_OCSP_NOT_ENABLED = (SEC_ERROR_BASE + 127), 178SEC_ERROR_OCSP_NO_DEFAULT_RESPONDER = (SEC_ERROR_BASE + 128), 179SEC_ERROR_OCSP_MALFORMED_RESPONSE = (SEC_ERROR_BASE + 129), 180SEC_ERROR_OCSP_UNAUTHORIZED_RESPONSE = (SEC_ERROR_BASE + 130), 181SEC_ERROR_OCSP_FUTURE_RESPONSE = (SEC_ERROR_BASE + 131), 182SEC_ERROR_OCSP_OLD_RESPONSE = (SEC_ERROR_BASE + 132), 183/* smime stuff */ 184SEC_ERROR_DIGEST_NOT_FOUND = (SEC_ERROR_BASE + 133), 185SEC_ERROR_UNSUPPORTED_MESSAGE_TYPE = (SEC_ERROR_BASE + 134), 186SEC_ERROR_MODULE_STUCK = (SEC_ERROR_BASE + 135), 187SEC_ERROR_BAD_TEMPLATE = (SEC_ERROR_BASE + 136), 188SEC_ERROR_CRL_NOT_FOUND = (SEC_ERROR_BASE + 137), 189SEC_ERROR_REUSED_ISSUER_AND_SERIAL = (SEC_ERROR_BASE + 138), 190SEC_ERROR_BUSY = (SEC_ERROR_BASE + 139), 191SEC_ERROR_NO_USER_INTERACTION = (SEC_ERROR_BASE + 140) 192} SECErrorCodes; 193#endif /* NO_SECURITY_ERROR_ENUM */ 194 195#ifdef __APPLE__ 196/* 197 * Given a PRErrorCode, obtain a const C string. Not copied, not 198 * to be freed by caller. 199 */ 200const char *SECErrorString(PRErrorCode err); 201 202#endif /* __APPLE__ */ 203 204PR_END_EXTERN_C 205 206#endif /* __SEC_ERR_H_ */ 207