diff options
author | Ingela Anderton Andin <[email protected]> | 2012-08-27 11:31:19 +0200 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2012-08-27 11:31:19 +0200 |
commit | 4877acc0598fe257315e8398dc9e11428d757000 (patch) | |
tree | c12bd2682dcc61665f72df7a2acbbeae97b86e36 /lib/ssl/src/ssl_handshake.erl | |
parent | 1e27e69bfb2f119aac822937cb2625313de1a6cd (diff) | |
parent | 69d4a56d9f7ade14fd0496ffbf56d96bf9184aef (diff) | |
download | otp-4877acc0598fe257315e8398dc9e11428d757000.tar.gz otp-4877acc0598fe257315e8398dc9e11428d757000.tar.bz2 otp-4877acc0598fe257315e8398dc9e11428d757000.zip |
Merge branch 'ia/ssl/countryname-utf8-workaround/OTP-10222' into maint
* ia/ssl/countryname-utf8-workaround/OTP-10222:
ssl & public_key: Workaround that some certificates encode countryname as utf8 and close down gracefully if other ASN-1 errors occur.
Diffstat (limited to 'lib/ssl/src/ssl_handshake.erl')
-rw-r--r-- | lib/ssl/src/ssl_handshake.erl | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/lib/ssl/src/ssl_handshake.erl b/lib/ssl/src/ssl_handshake.erl index 28469dfa5f..bb26302fff 100644 --- a/lib/ssl/src/ssl_handshake.erl +++ b/lib/ssl/src/ssl_handshake.erl @@ -220,18 +220,23 @@ certify(#certificate{asn1_certificates = ASN1Certs}, CertDbHandle, CertDbRef, end, {Role, UserState0}} end, - {TrustedErlCert, CertPath} = - ssl_certificate:trusted_cert_and_path(ASN1Certs, CertDbHandle, CertDbRef), - - case public_key:pkix_path_validation(TrustedErlCert, - CertPath, - [{max_path_length, - MaxPathLen}, - {verify_fun, ValidationFunAndState}]) of - {ok, {PublicKeyInfo,_}} -> - {PeerCert, PublicKeyInfo}; - {error, Reason} -> - path_validation_alert(Reason) + try + {TrustedErlCert, CertPath} = + ssl_certificate:trusted_cert_and_path(ASN1Certs, CertDbHandle, CertDbRef), + case public_key:pkix_path_validation(TrustedErlCert, + CertPath, + [{max_path_length, + MaxPathLen}, + {verify_fun, ValidationFunAndState}]) of + {ok, {PublicKeyInfo,_}} -> + {PeerCert, PublicKeyInfo}; + {error, Reason} -> + path_validation_alert(Reason) + end + catch + error:_ -> + %% ASN-1 decode of certificate somehow failed + ?ALERT_REC(?FATAL, ?CERTIFICATE_UNKNOWN) end. %%-------------------------------------------------------------------- |