Merge pull request #118 from docker/proto_update

Proto update
This commit is contained in:
David Lawrence 2015-07-22 17:18:56 -07:00
commit d790da7752
6 changed files with 21 additions and 7 deletions

View File

@ -95,7 +95,8 @@ 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"`
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

@ -46,7 +46,8 @@ message PublicKey {
// Signature specifies a KeyInfo that was used for signing and signed content
message Signature {
KeyInfo keyInfo = 1;
bytes content = 2;
Algorithm algorithm = 2;
bytes content = 3;
}
// SignatureRequests specifies a KeyInfo, and content to be signed

View File

@ -113,6 +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: &pb.Algorithm{Algorithm: signatures[0].Method.String()},
Content: signatures[0].Signature,
}

View File

@ -113,7 +113,11 @@ func (s *RSAHardwareCryptoService) RemoveKey(keyID string) error {
// GetKey returns the public components of a particular key
func (s *RSAHardwareCryptoService) GetKey(keyID string) data.PublicKey {
return s.keys[keyID]
key, ok := s.keys[keyID]
if !ok {
return nil
}
return key
}
// Sign returns a signature for a given signature request

View File

@ -54,7 +54,7 @@ func (trust *NotarySigner) Sign(keyIDs []string, toSign []byte) ([]data.Signatur
}
signatures = append(signatures, data.Signature{
KeyID: sig.KeyInfo.KeyID.ID,
Method: data.SigAlgorithm(sig.KeyInfo.Algorithm.Algorithm),
Method: data.SigAlgorithm(sig.Algorithm.Algorithm),
Signature: sig.Content,
})
}

View File

@ -365,7 +365,7 @@ func GenerateED25519Key(random io.Reader) (data.PrivateKey, error) {
return nil, err
}
logrus.Debugf("generated EDDSA key with keyID: %s", tufPrivKey.ID())
logrus.Debugf("generated ED25519 key with keyID: %s", tufPrivKey.ID())
return tufPrivKey, nil
}