FAQ
PTAL


https://codereview.appspot.com/6776043/diff/8001/src/pkg/crypto/tls/tls.go
File src/pkg/crypto/tls/tls.go (right):

https://codereview.appspot.com/6776043/diff/8001/src/pkg/crypto/tls/tls.go#newcode158
src/pkg/crypto/tls/tls.go:158: if strings.HasSuffix(keyDERBlock.Type,
"PRIVATE KEY") {
On 2012/11/14 16:32:59, agl1 wrote:
" PRIVATE KEY"
Done.

https://codereview.appspot.com/6776043/diff/8001/src/pkg/crypto/tls/tls.go#newcode175
src/pkg/crypto/tls/tls.go:175: switch x509Cert.PublicKeyAlgorithm {
On 2012/11/14 16:32:59, agl1 wrote:
It would seem cleaner to do a type switch on x509Cert.PublicKey. It
would save
having to cast it too.
Done.

https://codereview.appspot.com/6776043/diff/8001/src/pkg/crypto/tls/tls.go#newcode178
src/pkg/crypto/tls/tls.go:178: priv := cert.PrivateKey.(*rsa.PrivateKey)
On 2012/11/14 16:32:59, agl1 wrote:
This will crash if a non-RSA key is provided with an RSA cert.
Indeed. I've fixed this and have added a test case for it.

https://codereview.appspot.com/6776043/diff/8001/src/pkg/crypto/tls/tls.go#newcode185
src/pkg/crypto/tls/tls.go:185: priv :=
cert.PrivateKey.(*ecdsa.PrivateKey)
On 2012/11/14 16:32:59, agl1 wrote:
Ditto, but vice-versa.
Fixed.

https://codereview.appspot.com/6776043/diff/8001/src/pkg/crypto/tls/tls.go#newcode208
src/pkg/crypto/tls/tls.go:208: return key.(*rsa.PrivateKey), nil
On 2012/11/14 16:32:59, agl1 wrote:
Can just do switch key := key.(type) and avoid the casts here.
Yes, much nicer.

https://codereview.appspot.com/6776043/diff/8001/src/pkg/crypto/tls/tls.go#newcode212
src/pkg/crypto/tls/tls.go:212: return nil, errors.New("crypto/tls: found
unknown private key in PKCS#8 wrapping")
On 2012/11/14 16:32:59, agl1 wrote:
unknown private key /type/
Done.

https://codereview.appspot.com/6776043/

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedNov 15, '12 at 2:03p
activeNov 15, '12 at 5:57p
posts2
users2
websitegolang.org

2 users in discussion

Agl: 1 post Jsing: 1 post

People

Translate

site design / logo © 2022 Grokbase