mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[aws|iam] add proper error messages
This commit is contained in:
parent
00e38b3f9c
commit
674f11a104
1 changed files with 6 additions and 1 deletions
|
@ -54,7 +54,12 @@ module Fog
|
|||
cert = OpenSSL::X509::Certificate.new(certificate)
|
||||
key = OpenSSL::PKey::RSA.new(private_key)
|
||||
rescue OpenSSL::X509::CertificateError, OpenSSL::PKey::RSAError => e
|
||||
raise Fog::AWS::IAM::MalformedCertificate.new
|
||||
message = if e.is_a?(OpenSSL::X509::CertificateError)
|
||||
"Invalid Public Key Certificate."
|
||||
else
|
||||
"Invalid Private Key."
|
||||
end
|
||||
raise Fog::AWS::IAM::MalformedCertificate.new(message)
|
||||
end
|
||||
|
||||
unless cert.check_private_key(key)
|
||||
|
|
Loading…
Reference in a new issue