OLD | NEW |
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 // This package parses X.509-encoded keys and certificates. | 5 // This package parses X.509-encoded keys and certificates. |
6 package x509 | 6 package x509 |
7 | 7 |
8 import ( | 8 import ( |
9 "asn1" | 9 "asn1" |
10 "big" | 10 "big" |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 if err != nil { | 728 if err != nil { |
729 return | 729 return |
730 } | 730 } |
731 n++ | 731 n++ |
732 } | 732 } |
733 | 733 |
734 if len(template.DNSNames) > 0 { | 734 if len(template.DNSNames) > 0 { |
735 ret[n].Id = oidExtensionSubjectAltName | 735 ret[n].Id = oidExtensionSubjectAltName |
736 rawValues := make([]asn1.RawValue, len(template.DNSNames)) | 736 rawValues := make([]asn1.RawValue, len(template.DNSNames)) |
737 for i, name := range template.DNSNames { | 737 for i, name := range template.DNSNames { |
738 » » » rawValues[i] = asn1.RawValue{Tag: 2, Class: 2, Bytes: st
rings.Bytes(name)} | 738 » » » rawValues[i] = asn1.RawValue{Tag: 2, Class: 2, Bytes: []
byte(name)} |
739 } | 739 } |
740 ret[n].Value, err = asn1.MarshalToMemory(rawValues) | 740 ret[n].Value, err = asn1.MarshalToMemory(rawValues) |
741 if err != nil { | 741 if err != nil { |
742 return | 742 return |
743 } | 743 } |
744 n++ | 744 n++ |
745 } | 745 } |
746 | 746 |
747 // Adding another extension here? Remember to update the maximum number | 747 // Adding another extension here? Remember to update the maximum number |
748 // of elements in the make() at the top of the function. | 748 // of elements in the make() at the top of the function. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 return | 810 return |
811 } | 811 } |
812 | 812 |
813 cert, err = asn1.MarshalToMemory(certificate{ | 813 cert, err = asn1.MarshalToMemory(certificate{ |
814 c, | 814 c, |
815 algorithmIdentifier{oidSHA1WithRSA}, | 815 algorithmIdentifier{oidSHA1WithRSA}, |
816 asn1.BitString{Bytes: signature, BitLength: len(signature) * 8}, | 816 asn1.BitString{Bytes: signature, BitLength: len(signature) * 8}, |
817 }) | 817 }) |
818 return | 818 return |
819 } | 819 } |
OLD | NEW |