-
Notifications
You must be signed in to change notification settings - Fork 19
/
ssl_error_codes.rb
56 lines (51 loc) · 2.26 KB
/
ssl_error_codes.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# ------------------------------------------------------------------------------
# Copyright (c) 2019 SUSE LLC
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of version 2 of the GNU General Public License as published by the
# Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# ------------------------------------------------------------------------------
#
require "yast"
module Registration
# This class defines constants and translations for the most common OpenSSL errors
# @see https://www.openssl.org/docs/apps/verify.html
# @see https://github.com/openssl/openssl/blob/2c75f03b39de2fa7d006bc0f0d7c58235a54d9bb/include/openssl/x509_vfy.h#L99-L189
class SslErrorCodes
extend Yast::I18n
textdomain "registration"
# "certificate has expired"
EXPIRED = 10
# "self signed certificate"
SELF_SIGNED_CERT = 18
# "self signed certificate in certificate chain"
SELF_SIGNED_CERT_IN_CHAIN = 19
# "unable to get local issuer certificate"
NO_LOCAL_ISSUER_CERTIFICATE = 20
# openSSL error codes for which the import SSL certificate dialog is shown,
# for the other error codes just the error message is displayed
# (importing the certificate would not help)
IMPORT_ERROR_CODES = [
SELF_SIGNED_CERT,
SELF_SIGNED_CERT_IN_CHAIN
].freeze
# error code => translatable error message
# @note the text messages need to be translated at runtime via _() call
# @note we do not translate every possible OpenSSL error message, just the most common ones
OPENSSL_ERROR_MESSAGES = {
# TRANSLATORS: SSL error message
EXPIRED => N_("Certificate has expired"),
# TRANSLATORS: SSL error message
SELF_SIGNED_CERT => N_("Self signed certificate"),
# TRANSLATORS: SSL error message
SELF_SIGNED_CERT_IN_CHAIN => N_("Self signed certificate in certificate chain"),
# TRANSLATORS: SSL error message
NO_LOCAL_ISSUER_CERTIFICATE => N_("Unable to get local issuer certificate")
}.freeze
end
end