Fixing protobufs and signer

Signed-off-by: Diogo Monica <diogo@docker.com>
This commit is contained in:
Diogo Monica 2015-07-22 16:23:29 -07:00 committed by David Lawrence
parent 81d69a4f5c
commit 6f4e6fffea
2 changed files with 11 additions and 3 deletions

View File

@ -94,8 +94,9 @@ func (m *PublicKey) GetKeyInfo() *KeyInfo {
// Signature specifies a KeyInfo that was used for signing and signed content
type Signature struct {
KeyInfo *KeyInfo `protobuf:"bytes,1,opt,name=keyInfo" json:"keyInfo,omitempty"`
Content []byte `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"`
KeyInfo *KeyInfo `protobuf:"bytes,1,opt,name=keyInfo" json:"keyInfo,omitempty"`
Algorithm *Algorithm `protobuf:"bytes,2,opt,name=algorithm" json:"algorithm,omitempty"`
Content []byte `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"`
}
func (m *Signature) Reset() { *m = Signature{} }
@ -109,6 +110,13 @@ func (m *Signature) GetKeyInfo() *KeyInfo {
return nil
}
func (m *Signature) GetAlgorithm() *Algorithm {
if m != nil {
return m.Algorithm
}
return nil
}
// SignatureRequests specifies a KeyInfo, and content to be signed
type SignatureRequest struct {
KeyID *KeyID `protobuf:"bytes,1,opt,name=keyID" json:"keyID,omitempty"`

View File

@ -113,7 +113,7 @@ func (s *SignerServer) Sign(ctx context.Context, sr *pb.SignatureRequest) (*pb.S
KeyID: &pb.KeyID{ID: tufKey.ID()},
Algorithm: &pb.Algorithm{Algorithm: tufKey.Algorithm().String()},
},
Algorithm: signatures[0].Method,
Algorithm: &pb.Algorithm{Algorithm: signatures[0].Method.String()},
Content: signatures[0].Signature,
}