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

Delta Between Two Patch Sets: src/pkg/asn1/asn1.go

Issue 5172042: code review 5172042: asn1: accept UTF8 strings as ASN.1 ANY values (Closed)
Left Patch Set: Created 13 years, 5 months ago
Right Patch Set: diff -r 461aaa349934 https://go.googlecode.com/hg/ Created 13 years, 5 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 | no next file » | 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 asn1 implements parsing of DER-encoded ASN.1 data structures, 5 // Package asn1 implements parsing of DER-encoded ASN.1 data structures,
6 // as defined in ITU-T Rec X.690. 6 // as defined in ITU-T Rec X.690.
7 // 7 //
8 // See also ``A Layman's Guide to a Subset of ASN.1, BER, and DER,'' 8 // See also ``A Layman's Guide to a Subset of ASN.1, BER, and DER,''
9 // http://luca.ntop.org/Teaching/Appunti/asn1.html. 9 // http://luca.ntop.org/Teaching/Appunti/asn1.html.
10 package asn1 10 package asn1
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 var result interface{} 509 var result interface{}
510 if !t.isCompound && t.class == classUniversal { 510 if !t.isCompound && t.class == classUniversal {
511 innerBytes := bytes[offset : offset+t.length] 511 innerBytes := bytes[offset : offset+t.length]
512 switch t.tag { 512 switch t.tag {
513 case tagPrintableString: 513 case tagPrintableString:
514 result, err = parsePrintableString(innerBytes) 514 result, err = parsePrintableString(innerBytes)
515 case tagIA5String: 515 case tagIA5String:
516 result, err = parseIA5String(innerBytes) 516 result, err = parseIA5String(innerBytes)
517 case tagT61String: 517 case tagT61String:
518 result, err = parseT61String(innerBytes) 518 result, err = parseT61String(innerBytes)
519 case tagUTF8String:
520 result, err = parseUTF8String(innerBytes)
519 case tagInteger: 521 case tagInteger:
520 result, err = parseInt64(innerBytes) 522 result, err = parseInt64(innerBytes)
521 case tagBitString: 523 case tagBitString:
522 result, err = parseBitString(innerBytes) 524 result, err = parseBitString(innerBytes)
523 case tagOID: 525 case tagOID:
524 result, err = parseObjectIdentifier(innerBytes) 526 result, err = parseObjectIdentifier(innerBytes)
525 case tagUTCTime: 527 case tagUTCTime:
526 result, err = parseUTCTime(innerBytes) 528 result, err = parseUTCTime(innerBytes)
527 case tagOctetString: 529 case tagOctetString:
528 result = innerBytes 530 result = innerBytes
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 // UnmarshalWithParams allows field parameters to be specified for the 833 // UnmarshalWithParams allows field parameters to be specified for the
832 // top-level element. The form of the params is the same as the field tags. 834 // top-level element. The form of the params is the same as the field tags.
833 func UnmarshalWithParams(b []byte, val interface{}, params string) (rest []byte, err os.Error) { 835 func UnmarshalWithParams(b []byte, val interface{}, params string) (rest []byte, err os.Error) {
834 v := reflect.ValueOf(val).Elem() 836 v := reflect.ValueOf(val).Elem()
835 offset, err := parseField(v, b, 0, parseFieldParameters(params)) 837 offset, err := parseField(v, b, 0, parseFieldParameters(params))
836 if err != nil { 838 if err != nil {
837 return nil, err 839 return nil, err
838 } 840 }
839 return b[offset:], nil 841 return b[offset:], nil
840 } 842 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

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