Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support changes in signature schemes #380

Merged
merged 1 commit into from
Mar 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 27 additions & 10 deletions container/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,26 @@ func (c *Container) FromGRPCMessage(m grpc.Message) error {
return nil
}

func toSignatureRFC6979(s *refs.Signature) *refsGRPC.SignatureRFC6979 {
var res *refsGRPC.SignatureRFC6979

if s != nil {
res = new(refsGRPC.SignatureRFC6979)
res.SetKey(s.GetKey())
res.SetSign(s.GetSign())
}

return res
}

func (r *PutRequestBody) ToGRPCMessage() grpc.Message {
var m *container.PutRequest_Body

if r != nil {
m = new(container.PutRequest_Body)

m.SetContainer(r.cnr.ToGRPCMessage().(*container.Container))
m.SetSignature(r.sig.ToGRPCMessage().(*refsGRPC.Signature))
m.SetSignature(toSignatureRFC6979(r.sig))
}

return m
Expand Down Expand Up @@ -195,7 +207,8 @@ func (r *PutRequestBody) FromGRPCMessage(m grpc.Message) error {
r.sig = new(refs.Signature)
}

err = r.sig.FromGRPCMessage(sig)
r.sig.SetKey(sig.GetKey())
r.sig.SetSign(sig.GetSign())
}

return err
Expand Down Expand Up @@ -391,7 +404,7 @@ func (r *GetResponseBody) ToGRPCMessage() grpc.Message {

m.SetContainer(r.cnr.ToGRPCMessage().(*container.Container))
m.SetSessionToken(r.token.ToGRPCMessage().(*sessionGRPC.SessionToken))
m.SetSignature(r.sig.ToGRPCMessage().(*refsGRPC.Signature))
m.SetSignature(toSignatureRFC6979(r.sig))
}

return m
Expand Down Expand Up @@ -424,7 +437,8 @@ func (r *GetResponseBody) FromGRPCMessage(m grpc.Message) error {
r.sig = new(refs.Signature)
}

err = r.sig.FromGRPCMessage(sig)
r.sig.SetKey(sig.GetKey())
r.sig.SetSign(sig.GetSign())
}

token := v.GetSessionToken()
Expand Down Expand Up @@ -486,7 +500,7 @@ func (r *DeleteRequestBody) ToGRPCMessage() grpc.Message {
m = new(container.DeleteRequest_Body)

m.SetContainerId(r.cid.ToGRPCMessage().(*refsGRPC.ContainerID))
m.SetSignature(r.sig.ToGRPCMessage().(*refsGRPC.Signature))
m.SetSignature(toSignatureRFC6979(r.sig))
}

return m
Expand Down Expand Up @@ -522,7 +536,8 @@ func (r *DeleteRequestBody) FromGRPCMessage(m grpc.Message) error {
r.sig = new(refs.Signature)
}

err = r.sig.FromGRPCMessage(sig)
r.sig.SetKey(sig.GetKey())
r.sig.SetSign(sig.GetSign())
}

return err
Expand Down Expand Up @@ -765,7 +780,7 @@ func (r *SetExtendedACLRequestBody) ToGRPCMessage() grpc.Message {
m = new(container.SetExtendedACLRequest_Body)

m.SetEacl(r.eacl.ToGRPCMessage().(*aclGRPC.EACLTable))
m.SetSignature(r.sig.ToGRPCMessage().(*refsGRPC.Signature))
m.SetSignature(toSignatureRFC6979(r.sig))
}

return m
Expand Down Expand Up @@ -801,7 +816,8 @@ func (r *SetExtendedACLRequestBody) FromGRPCMessage(m grpc.Message) error {
r.sig = new(refs.Signature)
}

err = r.sig.FromGRPCMessage(sig)
r.sig.SetKey(sig.GetKey())
r.sig.SetSign(sig.GetSign())
}

return err
Expand Down Expand Up @@ -981,7 +997,7 @@ func (r *GetExtendedACLResponseBody) ToGRPCMessage() grpc.Message {
m = new(container.GetExtendedACLResponse_Body)

m.SetEacl(r.eacl.ToGRPCMessage().(*aclGRPC.EACLTable))
m.SetSignature(r.sig.ToGRPCMessage().(*refsGRPC.Signature))
m.SetSignature(toSignatureRFC6979(r.sig))
m.SetSessionToken(r.token.ToGRPCMessage().(*sessionGRPC.SessionToken))
}

Expand Down Expand Up @@ -1018,7 +1034,8 @@ func (r *GetExtendedACLResponseBody) FromGRPCMessage(m grpc.Message) error {
r.sig = new(refs.Signature)
}

err = r.sig.FromGRPCMessage(sig)
r.sig.SetKey(sig.GetKey())
r.sig.SetSign(sig.GetSign())
}

token := v.GetSessionToken()
Expand Down
16 changes: 8 additions & 8 deletions container/grpc/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func (m *PutRequest_Body) SetContainer(v *Container) {
}

// SetSignature sets signature of the container structure.
func (m *PutRequest_Body) SetSignature(v *refs.Signature) {
func (m *PutRequest_Body) SetSignature(v *refs.SignatureRFC6979) {
if m != nil {
m.Signature = v
}
Expand Down Expand Up @@ -77,7 +77,7 @@ func (m *DeleteRequest_Body) SetContainerId(v *refs.ContainerID) {
}

// SetSignature sets signature of the container identifier.
func (m *DeleteRequest_Body) SetSignature(v *refs.Signature) {
func (m *DeleteRequest_Body) SetSignature(v *refs.SignatureRFC6979) {
if m != nil {
m.Signature = v
}
Expand Down Expand Up @@ -166,8 +166,8 @@ func (m *GetResponse_Body) SetSessionToken(v *session.SessionToken) {
}
}

// SetSignature sets signature of the requested container.
func (m *GetResponse_Body) SetSignature(v *refs.Signature) {
// SetSignature sets signature of the container structure.
func (m *GetResponse_Body) SetSignature(v *refs.SignatureRFC6979) {
if m != nil {
m.Signature = v
}
Expand Down Expand Up @@ -257,8 +257,8 @@ func (m *SetExtendedACLRequest_Body) SetEacl(v *acl.EACLTable) {
}
}

// SetSignature sets signature of the eACL table.
func (m *SetExtendedACLRequest_Body) SetSignature(v *refs.Signature) {
// SetSignature sets signature of the eACL table structure.
func (m *SetExtendedACLRequest_Body) SetSignature(v *refs.SignatureRFC6979) {
if m != nil {
m.Signature = v
}
Expand Down Expand Up @@ -341,8 +341,8 @@ func (m *GetExtendedACLResponse_Body) SetEacl(v *acl.EACLTable) {
}
}

// SetSignature sets signature of the eACL table.
func (m *GetExtendedACLResponse_Body) SetSignature(v *refs.Signature) {
// SetSignature sets signature of the eACL table structure.
func (m *GetExtendedACLResponse_Body) SetSignature(v *refs.SignatureRFC6979) {
if m != nil {
m.Signature = v
}
Expand Down
Loading