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

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

Issue 5619052: code review 5619052: std: add struct field tags to untagged literals. (Closed)
Left Patch Set: Created 13 years, 2 months ago
Right Patch Set: diff -r 521f18f31406 https://go.googlecode.com/hg/ Created 13 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 | « no previous file | src/pkg/crypto/x509/x509.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 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 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 x509 5 package x509
6 6
7 import ( 7 import (
8 "crypto/rsa" 8 "crypto/rsa"
9 "encoding/asn1" 9 "encoding/asn1"
10 "errors" 10 "errors"
(...skipping 22 matching lines...) Expand all
33 // We ignore these values because rsa will calculate them. 33 // We ignore these values because rsa will calculate them.
34 Exp *big.Int 34 Exp *big.Int
35 Coeff *big.Int 35 Coeff *big.Int
36 } 36 }
37 37
38 // ParsePKCS1PrivateKey returns an RSA private key from its ASN.1 PKCS#1 DER enc oded form. 38 // ParsePKCS1PrivateKey returns an RSA private key from its ASN.1 PKCS#1 DER enc oded form.
39 func ParsePKCS1PrivateKey(der []byte) (key *rsa.PrivateKey, err error) { 39 func ParsePKCS1PrivateKey(der []byte) (key *rsa.PrivateKey, err error) {
40 var priv pkcs1PrivateKey 40 var priv pkcs1PrivateKey
41 rest, err := asn1.Unmarshal(der, &priv) 41 rest, err := asn1.Unmarshal(der, &priv)
42 if len(rest) > 0 { 42 if len(rest) > 0 {
43 » » err = asn1.SyntaxError{"trailing data"} 43 » » err = asn1.SyntaxError{Msg: "trailing data"}
44 return 44 return
45 } 45 }
46 if err != nil { 46 if err != nil {
47 return 47 return
48 } 48 }
49 49
50 if priv.Version > 1 { 50 if priv.Version > 1 {
51 return nil, errors.New("x509: unsupported private key version") 51 return nil, errors.New("x509: unsupported private key version")
52 } 52 }
53 53
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 b, _ := asn1.Marshal(priv) 114 b, _ := asn1.Marshal(priv)
115 return b 115 return b
116 } 116 }
117 117
118 // rsaPublicKey reflects the ASN.1 structure of a PKCS#1 public key. 118 // rsaPublicKey reflects the ASN.1 structure of a PKCS#1 public key.
119 type rsaPublicKey struct { 119 type rsaPublicKey struct {
120 N *big.Int 120 N *big.Int
121 E int 121 E int
122 } 122 }
LEFTRIGHT

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