Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(470)

Side by Side Diff: server/auth/signing/signingtest/signer.go

Issue 2386643003: auth: Make luci-go services trust signatures produced by the token server. (Closed)
Patch Set: add tests Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « server/auth/internal/testing.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « server/auth/internal/testing.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698