@@ -70,39 +70,12 @@ def self.encrypt_request_payload(merchant_config, request_payload)
70
70
end
71
71
end
72
72
73
-
74
- def self . get_certificate ( merchant_config , log_obj )
75
- begin
76
- p12_file_path = File . join ( merchant_config . keysDirectory , merchant_config . keyFilename + '.p12' )
77
- file = File . binread ( p12_file_path )
78
- p12_file = OpenSSL ::PKCS12 . new ( file , merchant_config . keyPass )
79
- x5_cert_pem = OpenSSL ::X509 ::Certificate . new ( p12_file . certificate )
80
- x5_cert_pem . subject . to_a . each do |attribute |
81
- return x5_cert_pem if attribute [ 1 ] . include? ( merchant_config . mleKeyAlias )
82
- end
83
- p12_file . ca_certs . each do |cert |
84
- cert . subject . to_a . each do |attribute |
85
- return cert if attribute [ 1 ] . include? ( merchant_config . mleKeyAlias )
86
- end
87
- end
88
- rescue OpenSSL ::PKCS12 ::PKCS12Error => e
89
- log_obj . logger . error ( "Failed to load PKCS12 file: #{ e . message } " )
90
- raise e
91
- rescue OpenSSL ::X509 ::CertificateError => e
92
- log_obj . logger . error ( "Failed to create X509 certificate: #{ e . message } " )
93
- raise e
94
- rescue StandardError => e
95
- log_obj . logger . error ( "An error occurred while getting the certificate: #{ e . message } " )
96
- raise e
97
- end
98
- end
99
-
100
73
def self . validate_certificate ( certificate , mle_key_alias , log_obj )
101
74
if certificate . not_after . nil?
102
75
log_obj . logger . warn ( "Certificate for MLE don't have expiry date." )
103
- end
104
- if certificate . not_after < Time . now
76
+ elsif certificate . not_after < Time . now
105
77
log_obj . logger . warn ( 'Certificate with MLE alias ' + mle_key_alias + ' is expired as of ' + certificate . not_after . to_s + ". Please update p12 file." )
78
+ # raise StandardError.new('Certificate required for MLE has been expired on : ' + certificate.not_after.to_s)
106
79
else
107
80
time_to_expire = certificate . not_after - Time . now
108
81
if time_to_expire < Constants ::CERTIFICATE_EXPIRY_DATE_WARNING_DAYS * 24 * 60 * 60
0 commit comments