PK\°ní3G3Gchallenge.pb.go// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.26.0 // protoc v3.12.4 // source: pb/challenge.proto package pb import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" ) const ( // Verify that this generated code is sufficiently up-to-date. _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) // Verify that runtime/protoimpl is sufficiently up-to-date. _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) type Point struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields X []byte `protobuf:"bytes,1,opt,name=x,proto3" json:"x,omitempty"` Y []byte `protobuf:"bytes,2,opt,name=y,proto3" json:"y,omitempty"` } func (x *Point) Reset() { *x = Point{} if protoimpl.UnsafeEnabled { mi := &file_pb_challenge_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Point) String() string { return protoimpl.X.MessageStringOf(x) } func (*Point) ProtoMessage() {} func (x *Point) ProtoReflect() protoreflect.Message { mi := &file_pb_challenge_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use Point.ProtoReflect.Descriptor instead. func (*Point) Descriptor() ([]byte, []int) { return file_pb_challenge_proto_rawDescGZIP(), []int{0} } func (x *Point) GetX() []byte { if x != nil { return x.X } return nil } func (x *Point) GetY() []byte { if x != nil { return x.Y } return nil } type Signature struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields R []byte `protobuf:"bytes,1,opt,name=r,proto3" json:"r,omitempty"` S []byte `protobuf:"bytes,2,opt,name=s,proto3" json:"s,omitempty"` } func (x *Signature) Reset() { *x = Signature{} if protoimpl.UnsafeEnabled { mi := &file_pb_challenge_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Signature) String() string { return protoimpl.X.MessageStringOf(x) } func (*Signature) ProtoMessage() {} func (x *Signature) ProtoReflect() protoreflect.Message { mi := &file_pb_challenge_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use Signature.ProtoReflect.Descriptor instead. func (*Signature) Descriptor() ([]byte, []int) { return file_pb_challenge_proto_rawDescGZIP(), []int{1} } func (x *Signature) GetR() []byte { if x != nil { return x.R } return nil } func (x *Signature) GetS() []byte { if x != nil { return x.S } return nil } type HelloRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields } func (x *HelloRequest) Reset() { *x = HelloRequest{} if protoimpl.UnsafeEnabled { mi := &file_pb_challenge_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *HelloRequest) String() string { return protoimpl.X.MessageStringOf(x) } func (*HelloRequest) ProtoMessage() {} func (x *HelloRequest) ProtoReflect() protoreflect.Message { mi := &file_pb_challenge_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use HelloRequest.ProtoReflect.Descriptor instead. func (*HelloRequest) Descriptor() ([]byte, []int) { return file_pb_challenge_proto_rawDescGZIP(), []int{2} } type HelloResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Message0 string `protobuf:"bytes,1,opt,name=message0,proto3" json:"message0,omitempty"` Message1 string `protobuf:"bytes,2,opt,name=message1,proto3" json:"message1,omitempty"` Pubkey *Point `protobuf:"bytes,3,opt,name=pubkey,proto3" json:"pubkey,omitempty"` } func (x *HelloResponse) Reset() { *x = HelloResponse{} if protoimpl.UnsafeEnabled { mi := &file_pb_challenge_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *HelloResponse) String() string { return protoimpl.X.MessageStringOf(x) } func (*HelloResponse) ProtoMessage() {} func (x *HelloResponse) ProtoReflect() protoreflect.Message { mi := &file_pb_challenge_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use HelloResponse.ProtoReflect.Descriptor instead. func (*HelloResponse) Descriptor() ([]byte, []int) { return file_pb_challenge_proto_rawDescGZIP(), []int{3} } func (x *HelloResponse) GetMessage0() string { if x != nil { return x.Message0 } return "" } func (x *HelloResponse) GetMessage1() string { if x != nil { return x.Message1 } return "" } func (x *HelloResponse) GetPubkey() *Point { if x != nil { return x.Pubkey } return nil } type SignRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Scalar []byte `protobuf:"bytes,1,opt,name=scalar,proto3" json:"scalar,omitempty"` } func (x *SignRequest) Reset() { *x = SignRequest{} if protoimpl.UnsafeEnabled { mi := &file_pb_challenge_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *SignRequest) String() string { return protoimpl.X.MessageStringOf(x) } func (*SignRequest) ProtoMessage() {} func (x *SignRequest) ProtoReflect() protoreflect.Message { mi := &file_pb_challenge_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use SignRequest.ProtoReflect.Descriptor instead. func (*SignRequest) Descriptor() ([]byte, []int) { return file_pb_challenge_proto_rawDescGZIP(), []int{4} } func (x *SignRequest) GetScalar() []byte { if x != nil { return x.Scalar } return nil } type SignResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Message0Sig *Signature `protobuf:"bytes,1,opt,name=message0_sig,json=message0Sig,proto3" json:"message0_sig,omitempty"` } func (x *SignResponse) Reset() { *x = SignResponse{} if protoimpl.UnsafeEnabled { mi := &file_pb_challenge_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *SignResponse) String() string { return protoimpl.X.MessageStringOf(x) } func (*SignResponse) ProtoMessage() {} func (x *SignResponse) ProtoReflect() protoreflect.Message { mi := &file_pb_challenge_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use SignResponse.ProtoReflect.Descriptor instead. func (*SignResponse) Descriptor() ([]byte, []int) { return file_pb_challenge_proto_rawDescGZIP(), []int{5} } func (x *SignResponse) GetMessage0Sig() *Signature { if x != nil { return x.Message0Sig } return nil } type VerifyRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Message1Sig *Signature `protobuf:"bytes,1,opt,name=message1_sig,json=message1Sig,proto3" json:"message1_sig,omitempty"` } func (x *VerifyRequest) Reset() { *x = VerifyRequest{} if protoimpl.UnsafeEnabled { mi := &file_pb_challenge_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *VerifyRequest) String() string { return protoimpl.X.MessageStringOf(x) } func (*VerifyRequest) ProtoMessage() {} func (x *VerifyRequest) ProtoReflect() protoreflect.Message { mi := &file_pb_challenge_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use VerifyRequest.ProtoReflect.Descriptor instead. func (*VerifyRequest) Descriptor() ([]byte, []int) { return file_pb_challenge_proto_rawDescGZIP(), []int{6} } func (x *VerifyRequest) GetMessage1Sig() *Signature { if x != nil { return x.Message1Sig } return nil } type VerifyResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Flag string `protobuf:"bytes,1,opt,name=flag,proto3" json:"flag,omitempty"` } func (x *VerifyResponse) Reset() { *x = VerifyResponse{} if protoimpl.UnsafeEnabled { mi := &file_pb_challenge_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *VerifyResponse) String() string { return protoimpl.X.MessageStringOf(x) } func (*VerifyResponse) ProtoMessage() {} func (x *VerifyResponse) ProtoReflect() protoreflect.Message { mi := &file_pb_challenge_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use VerifyResponse.ProtoReflect.Descriptor instead. func (*VerifyResponse) Descriptor() ([]byte, []int) { return file_pb_challenge_proto_rawDescGZIP(), []int{7} } func (x *VerifyResponse) GetFlag() string { if x != nil { return x.Flag } return "" } var File_pb_challenge_proto protoreflect.FileDescriptor var file_pb_challenge_proto_rawDesc = []byte{ 0x0a, 0x12, 0x70, 0x62, 0x2f, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x22, 0x23, 0x0a, 0x05, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x01, 0x78, 0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x01, 0x79, 0x22, 0x27, 0x0a, 0x09, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x0c, 0x0a, 0x01, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x01, 0x72, 0x12, 0x0c, 0x0a, 0x01, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x01, 0x73, 0x22, 0x0e, 0x0a, 0x0c, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x71, 0x0a, 0x0d, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x30, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x30, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x31, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x31, 0x12, 0x28, 0x0a, 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x2e, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x22, 0x25, 0x0a, 0x0b, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x61, 0x6c, 0x61, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x63, 0x61, 0x6c, 0x61, 0x72, 0x22, 0x47, 0x0a, 0x0c, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x30, 0x5f, 0x73, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x30, 0x53, 0x69, 0x67, 0x22, 0x48, 0x0a, 0x0d, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x37, 0x0a, 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x31, 0x5f, 0x73, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x31, 0x53, 0x69, 0x67, 0x22, 0x24, 0x0a, 0x0e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x6c, 0x61, 0x67, 0x42, 0x05, 0x5a, 0x03, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_pb_challenge_proto_rawDescOnce sync.Once file_pb_challenge_proto_rawDescData = file_pb_challenge_proto_rawDesc ) func file_pb_challenge_proto_rawDescGZIP() []byte { file_pb_challenge_proto_rawDescOnce.Do(func() { file_pb_challenge_proto_rawDescData = protoimpl.X.CompressGZIP(file_pb_challenge_proto_rawDescData) }) return file_pb_challenge_proto_rawDescData } var file_pb_challenge_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_pb_challenge_proto_goTypes = []interface{}{ (*Point)(nil), // 0: challenge.Point (*Signature)(nil), // 1: challenge.Signature (*HelloRequest)(nil), // 2: challenge.HelloRequest (*HelloResponse)(nil), // 3: challenge.HelloResponse (*SignRequest)(nil), // 4: challenge.SignRequest (*SignResponse)(nil), // 5: challenge.SignResponse (*VerifyRequest)(nil), // 6: challenge.VerifyRequest (*VerifyResponse)(nil), // 7: challenge.VerifyResponse } var file_pb_challenge_proto_depIdxs = []int32{ 0, // 0: challenge.HelloResponse.pubkey:type_name -> challenge.Point 1, // 1: challenge.SignResponse.message0_sig:type_name -> challenge.Signature 1, // 2: challenge.VerifyRequest.message1_sig:type_name -> challenge.Signature 3, // [3:3] is the sub-list for method output_type 3, // [3:3] is the sub-list for method input_type 3, // [3:3] is the sub-list for extension type_name 3, // [3:3] is the sub-list for extension extendee 0, // [0:3] is the sub-list for field type_name } func init() { file_pb_challenge_proto_init() } func file_pb_challenge_proto_init() { if File_pb_challenge_proto != nil { return } if !protoimpl.UnsafeEnabled { file_pb_challenge_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Point); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_pb_challenge_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Signature); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_pb_challenge_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*HelloRequest); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_pb_challenge_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*HelloResponse); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_pb_challenge_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SignRequest); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_pb_challenge_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SignResponse); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_pb_challenge_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*VerifyRequest); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_pb_challenge_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*VerifyResponse); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_pb_challenge_proto_rawDesc, NumEnums: 0, NumMessages: 8, NumExtensions: 0, NumServices: 0, }, GoTypes: file_pb_challenge_proto_goTypes, DependencyIndexes: file_pb_challenge_proto_depIdxs, MessageInfos: file_pb_challenge_proto_msgTypes, }.Build() File_pb_challenge_proto = out.File file_pb_challenge_proto_rawDesc = nil file_pb_challenge_proto_goTypes = nil file_pb_challenge_proto_depIdxs = nil } PK¯®00challenge.proto// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. syntax = "proto3"; package challenge; option go_package="/pb"; message Point { bytes x = 1; bytes y = 2; } message Signature { bytes r = 1; bytes s = 2; } message HelloRequest { } message HelloResponse { string message0 = 1; string message1 = 2; Point pubkey = 3; } message SignRequest { bytes scalar = 1; } message SignResponse { Signature message0_sig = 1; } message VerifyRequest { Signature message1_sig = 1; } message VerifyResponse { string flag = 1; } PK¦é…¤00challenge_pb2.py# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: pb/challenge.proto from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() DESCRIPTOR = _descriptor.FileDescriptor( name='pb/challenge.proto', package='challenge', syntax='proto3', serialized_options=b'Z\003/pb', create_key=_descriptor._internal_create_key, serialized_pb=b'\n\x12pb/challenge.proto\x12\tchallenge\"\x1d\n\x05Point\x12\t\n\x01x\x18\x01 \x01(\x0c\x12\t\n\x01y\x18\x02 \x01(\x0c\"!\n\tSignature\x12\t\n\x01r\x18\x01 \x01(\x0c\x12\t\n\x01s\x18\x02 \x01(\x0c\"\x0e\n\x0cHelloRequest\"U\n\rHelloResponse\x12\x10\n\x08message0\x18\x01 \x01(\t\x12\x10\n\x08message1\x18\x02 \x01(\t\x12 \n\x06pubkey\x18\x03 \x01(\x0b\x32\x10.challenge.Point\"\x1d\n\x0bSignRequest\x12\x0e\n\x06scalar\x18\x01 \x01(\x0c\":\n\x0cSignResponse\x12*\n\x0cmessage0_sig\x18\x01 \x01(\x0b\x32\x14.challenge.Signature\";\n\rVerifyRequest\x12*\n\x0cmessage1_sig\x18\x01 \x01(\x0b\x32\x14.challenge.Signature\"\x1e\n\x0eVerifyResponse\x12\x0c\n\x04\x66lag\x18\x01 \x01(\tB\x05Z\x03/pbb\x06proto3' ) _POINT = _descriptor.Descriptor( name='Point', full_name='challenge.Point', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name='x', full_name='challenge.Point.x', index=0, number=1, type=12, cpp_type=9, label=1, has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( name='y', full_name='challenge.Point.y', index=1, number=2, type=12, cpp_type=9, label=1, has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=33, serialized_end=62, ) _SIGNATURE = _descriptor.Descriptor( name='Signature', full_name='challenge.Signature', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name='r', full_name='challenge.Signature.r', index=0, number=1, type=12, cpp_type=9, label=1, has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( name='s', full_name='challenge.Signature.s', index=1, number=2, type=12, cpp_type=9, label=1, has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=64, serialized_end=97, ) _HELLOREQUEST = _descriptor.Descriptor( name='HelloRequest', full_name='challenge.HelloRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=99, serialized_end=113, ) _HELLORESPONSE = _descriptor.Descriptor( name='HelloResponse', full_name='challenge.HelloResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name='message0', full_name='challenge.HelloResponse.message0', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=b"".decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( name='message1', full_name='challenge.HelloResponse.message1', index=1, number=2, type=9, cpp_type=9, label=1, has_default_value=False, default_value=b"".decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( name='pubkey', full_name='challenge.HelloResponse.pubkey', index=2, number=3, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=115, serialized_end=200, ) _SIGNREQUEST = _descriptor.Descriptor( name='SignRequest', full_name='challenge.SignRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name='scalar', full_name='challenge.SignRequest.scalar', index=0, number=1, type=12, cpp_type=9, label=1, has_default_value=False, default_value=b"", message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=202, serialized_end=231, ) _SIGNRESPONSE = _descriptor.Descriptor( name='SignResponse', full_name='challenge.SignResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name='message0_sig', full_name='challenge.SignResponse.message0_sig', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=233, serialized_end=291, ) _VERIFYREQUEST = _descriptor.Descriptor( name='VerifyRequest', full_name='challenge.VerifyRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name='message1_sig', full_name='challenge.VerifyRequest.message1_sig', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=293, serialized_end=352, ) _VERIFYRESPONSE = _descriptor.Descriptor( name='VerifyResponse', full_name='challenge.VerifyResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name='flag', full_name='challenge.VerifyResponse.flag', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=b"".decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=354, serialized_end=384, ) _HELLORESPONSE.fields_by_name['pubkey'].message_type = _POINT _SIGNRESPONSE.fields_by_name['message0_sig'].message_type = _SIGNATURE _VERIFYREQUEST.fields_by_name['message1_sig'].message_type = _SIGNATURE DESCRIPTOR.message_types_by_name['Point'] = _POINT DESCRIPTOR.message_types_by_name['Signature'] = _SIGNATURE DESCRIPTOR.message_types_by_name['HelloRequest'] = _HELLOREQUEST DESCRIPTOR.message_types_by_name['HelloResponse'] = _HELLORESPONSE DESCRIPTOR.message_types_by_name['SignRequest'] = _SIGNREQUEST DESCRIPTOR.message_types_by_name['SignResponse'] = _SIGNRESPONSE DESCRIPTOR.message_types_by_name['VerifyRequest'] = _VERIFYREQUEST DESCRIPTOR.message_types_by_name['VerifyResponse'] = _VERIFYRESPONSE _sym_db.RegisterFileDescriptor(DESCRIPTOR) Point = _reflection.GeneratedProtocolMessageType('Point', (_message.Message,), { 'DESCRIPTOR' : _POINT, '__module__' : 'pb.challenge_pb2' # @@protoc_insertion_point(class_scope:challenge.Point) }) _sym_db.RegisterMessage(Point) Signature = _reflection.GeneratedProtocolMessageType('Signature', (_message.Message,), { 'DESCRIPTOR' : _SIGNATURE, '__module__' : 'pb.challenge_pb2' # @@protoc_insertion_point(class_scope:challenge.Signature) }) _sym_db.RegisterMessage(Signature) HelloRequest = _reflection.GeneratedProtocolMessageType('HelloRequest', (_message.Message,), { 'DESCRIPTOR' : _HELLOREQUEST, '__module__' : 'pb.challenge_pb2' # @@protoc_insertion_point(class_scope:challenge.HelloRequest) }) _sym_db.RegisterMessage(HelloRequest) HelloResponse = _reflection.GeneratedProtocolMessageType('HelloResponse', (_message.Message,), { 'DESCRIPTOR' : _HELLORESPONSE, '__module__' : 'pb.challenge_pb2' # @@protoc_insertion_point(class_scope:challenge.HelloResponse) }) _sym_db.RegisterMessage(HelloResponse) SignRequest = _reflection.GeneratedProtocolMessageType('SignRequest', (_message.Message,), { 'DESCRIPTOR' : _SIGNREQUEST, '__module__' : 'pb.challenge_pb2' # @@protoc_insertion_point(class_scope:challenge.SignRequest) }) _sym_db.RegisterMessage(SignRequest) SignResponse = _reflection.GeneratedProtocolMessageType('SignResponse', (_message.Message,), { 'DESCRIPTOR' : _SIGNRESPONSE, '__module__' : 'pb.challenge_pb2' # @@protoc_insertion_point(class_scope:challenge.SignResponse) }) _sym_db.RegisterMessage(SignResponse) VerifyRequest = _reflection.GeneratedProtocolMessageType('VerifyRequest', (_message.Message,), { 'DESCRIPTOR' : _VERIFYREQUEST, '__module__' : 'pb.challenge_pb2' # @@protoc_insertion_point(class_scope:challenge.VerifyRequest) }) _sym_db.RegisterMessage(VerifyRequest) VerifyResponse = _reflection.GeneratedProtocolMessageType('VerifyResponse', (_message.Message,), { 'DESCRIPTOR' : _VERIFYRESPONSE, '__module__' : 'pb.challenge_pb2' # @@protoc_insertion_point(class_scope:challenge.VerifyResponse) }) _sym_db.RegisterMessage(VerifyResponse) DESCRIPTOR._options = None # @@protoc_insertion_point(module_scope) PK³ëKš| | challenger.go// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package challenger import ( "crypto-tonality/pb" "crypto/ecdsa" "crypto/elliptic" "crypto/rand" "crypto/sha1" "io" "math/big" ) const m0 = "Server says 1+1=2" const m1 = "Server says 1+1=3" func hashMessage(m string) []byte { h := sha1.New() io.WriteString(h, m) return h.Sum(nil) } type Challenger struct { flag string sk *ecdsa.PrivateKey } func NewChallenger(flag string) (*Challenger, error) { sk, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) if err != nil { return nil, err } return &Challenger{ flag: flag, sk: sk, }, nil } func (chal *Challenger) Hello(req *pb.HelloRequest) *pb.HelloResponse { return &pb.HelloResponse{ Message0: m0, Message1: m1, Pubkey: &pb.Point{ X: chal.sk.PublicKey.X.Bytes(), Y: chal.sk.PublicKey.Y.Bytes(), }, } } func (chal *Challenger) scalePrivate(t *big.Int) *ecdsa.PrivateKey { rk := new(big.Int).Mul(chal.sk.D, t) rk.Mod(rk, chal.sk.PublicKey.Curve.Params().N) ret := new(ecdsa.PrivateKey) ret.PublicKey.Curve = chal.sk.PublicKey.Curve ret.D = rk ret.PublicKey.X, ret.PublicKey.Y = chal.sk.PublicKey.Curve.ScalarBaseMult(ret.D.Bytes()) return ret } func (chal *Challenger) SignFirstMessage(req *pb.SignRequest) *pb.SignResponse { t := new(big.Int).SetBytes(req.Scalar) r, s, err := ecdsa.Sign(rand.Reader, chal.scalePrivate(t), hashMessage(m0)) if err != nil { return &pb.SignResponse{} } return &pb.SignResponse{ Message0Sig: &pb.Signature{ R: r.Bytes(), S: s.Bytes(), }, } } func (chal *Challenger) VerifySecondMessage(req *pb.VerifyRequest) *pb.VerifyResponse { r := new(big.Int).SetBytes(req.Message1Sig.R) s := new(big.Int).SetBytes(req.Message1Sig.S) ok := ecdsa.Verify(&chal.sk.PublicKey, hashMessage(m1), r, s) if !ok { return &pb.VerifyResponse{} } return &pb.VerifyResponse{Flag: chal.flag} } PK=  yyclient_skel.py#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import argparse import pwnlib import challenge_pb2 import struct import sys def handle_pow(tube): raise NotImplemented() def read_message(tube, typ): n = struct.unpack(' maxMessageLengh { return fmt.Errorf("want legnth <= %d, got %d", maxMessageLengh, length) } buf := make([]byte, length) if n, err := r.Read(buf); n != len(buf) || err != nil { return fmt.Errorf("failed to read serialized message, r.Read(buf) = %v, %v, want n=%d and nil error", n, err, len(buf)) } if err := proto.Unmarshal(buf, m); err != nil { return fmt.Errorf("failed to unmarshal message, proto.Unmarshal(%X, m) = %v, want nil error", buf, err) } return nil } func runSession(chal *challenger.Challenger, r io.Reader, w io.Writer) error { hello := chal.Hello(&pb.HelloRequest{}) if err := writeMessage(w, hello); err != nil { return fmt.Errorf("writeMessage(w, hello=%X)=%v, want nil err", hello, err) } signReq := &pb.SignRequest{} if err := readMessage(r, signReq); err != nil { return fmt.Errorf("readMessage(r, signReq)=%v, want nil err", err) } signRes := chal.SignFirstMessage(signReq) if err := writeMessage(w, signRes); err != nil { return fmt.Errorf("writeMessage(w, signRes=%X)=%v, want nil err", signRes, err) } verifyReq := &pb.VerifyRequest{} if err := readMessage(r, verifyReq); err != nil { return fmt.Errorf("readMessage(r, verifyReq)=%v, want nil err", err) } verifyRes := chal.VerifySecondMessage(verifyReq) if err := writeMessage(w, verifyRes); err != nil { return fmt.Errorf("writeMessage(w, verifyRes=%X)=%v, want nil err", verifyRes, err) } return nil } func init() { flag.StringVar(&flagFile, "flag", "/flag", "flag filename") } func main() { defer func() { if r := recover(); r != nil { // Uncomment to catch panics during development. // panic(r) } }() flag.Parse() f, err := ioutil.ReadFile(flagFile) if err != nil { panic(err) } chal, err := challenger.NewChallenger(strings.TrimSpace(string(f))) if err != nil { panic(err) } err = runSession(chal, os.Stdin, os.Stdout) if err != nil { panic(err) } } PK\°ní3G3G¤challenge.pb.goPK¯®00¤`Gchallenge.protoPK¦é…¤00¤½Kchallenge_pb2.pyPK³ëKš| | ¤|challenger.goPK=  yy¤¨…client_skel.pyPKî^ÕU ¤MŽserver.goPKfwœ