Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(696)

Delta Between Two Patch Sets: src/pkg/crypto/tls/tls.go

Issue 5448093: crypto/tls: Make TLS Client Authentication work according to the spec (Closed)
Left Patch Set: diff -r b16a53f58594 https://code.google.com/p/go/ Created 12 years, 3 months ago
Right Patch Set: diff -r 7ec969250bfc https://go.googlecode.com/hg/ Created 12 years, 2 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/crypto/tls/handshake_server_test.go ('k') | src/pkg/crypto/x509/cert_pool.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // Package tls partially implements the TLS 1.1 protocol, as specified in RFC 5 // Package tls partially implements the TLS 1.1 protocol, as specified in RFC
6 // 4346. 6 // 4346.
7 package tls 7 package tls
8 8
9 import ( 9 import (
10 "crypto/rsa" 10 "crypto/rsa"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 conn := Client(c, config) 113 conn := Client(c, config)
114 if err = conn.Handshake(); err != nil { 114 if err = conn.Handshake(); err != nil {
115 c.Close() 115 c.Close()
116 return nil, err 116 return nil, err
117 } 117 }
118 return conn, nil 118 return conn, nil
119 } 119 }
120 120
121 // LoadX509KeyPair reads and parses a public/private key pair from a pair of 121 // LoadX509KeyPair reads and parses a public/private key pair from a pair of
122 // files. The files must contain PEM encoded data. 122 // files. The files must contain PEM encoded data.
123 func LoadX509KeyPair(certFile string, keyFile string) (cert Certificate, err err or) { 123 func LoadX509KeyPair(certFile, keyFile string) (cert Certificate, err error) {
124 certPEMBlock, err := ioutil.ReadFile(certFile) 124 certPEMBlock, err := ioutil.ReadFile(certFile)
125 if err != nil { 125 if err != nil {
126 return 126 return
127 } 127 }
128 keyPEMBlock, err := ioutil.ReadFile(keyFile) 128 keyPEMBlock, err := ioutil.ReadFile(keyFile)
129 if err != nil { 129 if err != nil {
130 return 130 return
131 } 131 }
132 return X509KeyPair(certPEMBlock, keyPEMBlock) 132 return X509KeyPair(certPEMBlock, keyPEMBlock)
133 } 133 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 return 183 return
184 } 184 }
185 185
186 if x509Cert.PublicKeyAlgorithm != x509.RSA || x509Cert.PublicKey.(*rsa.P ublicKey).N.Cmp(key.PublicKey.N) != 0 { 186 if x509Cert.PublicKeyAlgorithm != x509.RSA || x509Cert.PublicKey.(*rsa.P ublicKey).N.Cmp(key.PublicKey.N) != 0 {
187 err = errors.New("crypto/tls: private key does not match public key") 187 err = errors.New("crypto/tls: private key does not match public key")
188 return 188 return
189 } 189 }
190 190
191 return 191 return
192 } 192 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b