mirror of https://github.com/docker/docs.git
commit
d790da7752
|
@ -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"`
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -113,7 +113,8 @@ 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()},
|
||||
},
|
||||
Content: signatures[0].Signature,
|
||||
Algorithm: &pb.Algorithm{Algorithm: signatures[0].Method.String()},
|
||||
Content: signatures[0].Signature,
|
||||
}
|
||||
|
||||
return signature, nil
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue