OLD | NEW |
1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 The LUCI Authors. All rights reserved. |
2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
4 | 4 |
5 package signingtest | 5 package signingtest |
6 | 6 |
7 import ( | 7 import ( |
8 "crypto" | 8 "crypto" |
9 "crypto/rsa" | 9 "crypto/rsa" |
10 "crypto/sha1" | 10 "crypto/sha1" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 keyName := sha1.Sum(der) | 60 keyName := sha1.Sum(der) |
61 | 61 |
62 // Put in default service info if necessary. | 62 // Put in default service info if necessary. |
63 if serviceInfo == nil { | 63 if serviceInfo == nil { |
64 serviceInfo = &signing.ServiceInfo{} | 64 serviceInfo = &signing.ServiceInfo{} |
65 } | 65 } |
66 | 66 |
67 return &Signer{ | 67 return &Signer{ |
68 priv: priv, | 68 priv: priv, |
69 certs: signing.PublicCertificates{ | 69 certs: signing.PublicCertificates{ |
| 70 AppID: serviceInfo.AppID, |
70 ServiceAccountName: serviceInfo.ServiceAccountName, | 71 ServiceAccountName: serviceInfo.ServiceAccountName, |
71 Certificates: []signing.Certificate{ | 72 Certificates: []signing.Certificate{ |
72 { | 73 { |
73 KeyName: hex.EncodeToString(k
eyName[:]), | 74 KeyName: hex.EncodeToString(k
eyName[:]), |
74 X509CertificatePEM: string(pemOut), | 75 X509CertificatePEM: string(pemOut), |
75 }, | 76 }, |
76 }, | 77 }, |
77 Timestamp: signing.JSONTime(time.Unix(1000000000, 0)), | 78 Timestamp: signing.JSONTime(time.Unix(1000000000, 0)), |
78 }, | 79 }, |
79 serviceInfo: *serviceInfo, | 80 serviceInfo: *serviceInfo, |
(...skipping 29 matching lines...) Expand all Loading... |
109 type notRandom struct { | 110 type notRandom struct { |
110 *rand.Rand | 111 *rand.Rand |
111 } | 112 } |
112 | 113 |
113 func (r notRandom) Read(p []byte) (n int, err error) { | 114 func (r notRandom) Read(p []byte) (n int, err error) { |
114 for i := range p { | 115 for i := range p { |
115 p[i] = byte(r.Intn(256)) | 116 p[i] = byte(r.Intn(256)) |
116 } | 117 } |
117 return len(p), nil | 118 return len(p), nil |
118 } | 119 } |
OLD | NEW |