gitee.com/lh-her-team/common@v1.5.1/helper/libp2pcrypto/pb/crypto.pb.go (about) 1 // Code generated by protoc-gen-gogo. DO NOT EDIT. 2 // source: crypto.proto 3 4 package pb 5 6 import ( 7 fmt "fmt" 8 io "io" 9 math "math" 10 math_bits "math/bits" 11 12 github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" 13 proto "github.com/gogo/protobuf/proto" 14 ) 15 16 // Reference imports to suppress errors if they are not otherwise used. 17 var _ = proto.Marshal 18 var _ = fmt.Errorf 19 var _ = math.Inf 20 21 // This is a compile-time assertion to ensure that this generated file 22 // is compatible with the proto package it is being compiled against. 23 // A compilation error at this line likely means your copy of the 24 // proto package needs to be updated. 25 const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package 26 27 type KeyType int32 28 29 const ( 30 KeyType_RSA KeyType = 0 31 KeyType_Ed25519 KeyType = 1 32 KeyType_Secp256k1 KeyType = 2 33 KeyType_ECDSA KeyType = 3 34 KeyType_SM2 KeyType = 4 35 ) 36 37 var KeyType_name = map[int32]string{ 38 0: "RSA", 39 1: "Ed25519", 40 2: "Secp256k1", 41 3: "ECDSA", 42 4: "SM2", 43 } 44 45 var KeyType_value = map[string]int32{ 46 "RSA": 0, 47 "Ed25519": 1, 48 "Secp256k1": 2, 49 "ECDSA": 3, 50 "SM2": 4, 51 } 52 53 func (x KeyType) Enum() *KeyType { 54 p := new(KeyType) 55 *p = x 56 return p 57 } 58 59 func (x KeyType) String() string { 60 return proto.EnumName(KeyType_name, int32(x)) 61 } 62 63 func (x *KeyType) UnmarshalJSON(data []byte) error { 64 value, err := proto.UnmarshalJSONEnum(KeyType_value, data, "KeyType") 65 if err != nil { 66 return err 67 } 68 *x = KeyType(value) 69 return nil 70 } 71 72 func (KeyType) EnumDescriptor() ([]byte, []int) { 73 return fileDescriptor_527278fb02d03321, []int{0} 74 } 75 76 type PublicKey struct { 77 Type KeyType `protobuf:"varint,1,req,name=Type,enum=libp2pcrypto.pb.KeyType" json:"Type"` 78 Data []byte `protobuf:"bytes,2,req,name=Data" json:"Data"` 79 } 80 81 func (m *PublicKey) Reset() { *m = PublicKey{} } 82 func (m *PublicKey) String() string { return proto.CompactTextString(m) } 83 func (*PublicKey) ProtoMessage() {} 84 func (*PublicKey) Descriptor() ([]byte, []int) { 85 return fileDescriptor_527278fb02d03321, []int{0} 86 } 87 func (m *PublicKey) XXX_Unmarshal(b []byte) error { 88 return m.Unmarshal(b) 89 } 90 func (m *PublicKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 91 if deterministic { 92 return xxx_messageInfo_PublicKey.Marshal(b, m, deterministic) 93 } else { 94 b = b[:cap(b)] 95 n, err := m.MarshalToSizedBuffer(b) 96 if err != nil { 97 return nil, err 98 } 99 return b[:n], nil 100 } 101 } 102 func (m *PublicKey) XXX_Merge(src proto.Message) { 103 xxx_messageInfo_PublicKey.Merge(m, src) 104 } 105 func (m *PublicKey) XXX_Size() int { 106 return m.Size() 107 } 108 func (m *PublicKey) XXX_DiscardUnknown() { 109 xxx_messageInfo_PublicKey.DiscardUnknown(m) 110 } 111 112 var xxx_messageInfo_PublicKey proto.InternalMessageInfo 113 114 func (m *PublicKey) GetType() KeyType { 115 if m != nil { 116 return m.Type 117 } 118 return KeyType_RSA 119 } 120 121 func (m *PublicKey) GetData() []byte { 122 if m != nil { 123 return m.Data 124 } 125 return nil 126 } 127 128 type PrivateKey struct { 129 Type KeyType `protobuf:"varint,1,req,name=Type,enum=libp2pcrypto.pb.KeyType" json:"Type"` 130 Data []byte `protobuf:"bytes,2,req,name=Data" json:"Data"` 131 } 132 133 func (m *PrivateKey) Reset() { *m = PrivateKey{} } 134 func (m *PrivateKey) String() string { return proto.CompactTextString(m) } 135 func (*PrivateKey) ProtoMessage() {} 136 func (*PrivateKey) Descriptor() ([]byte, []int) { 137 return fileDescriptor_527278fb02d03321, []int{1} 138 } 139 func (m *PrivateKey) XXX_Unmarshal(b []byte) error { 140 return m.Unmarshal(b) 141 } 142 func (m *PrivateKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 143 if deterministic { 144 return xxx_messageInfo_PrivateKey.Marshal(b, m, deterministic) 145 } else { 146 b = b[:cap(b)] 147 n, err := m.MarshalToSizedBuffer(b) 148 if err != nil { 149 return nil, err 150 } 151 return b[:n], nil 152 } 153 } 154 func (m *PrivateKey) XXX_Merge(src proto.Message) { 155 xxx_messageInfo_PrivateKey.Merge(m, src) 156 } 157 func (m *PrivateKey) XXX_Size() int { 158 return m.Size() 159 } 160 func (m *PrivateKey) XXX_DiscardUnknown() { 161 xxx_messageInfo_PrivateKey.DiscardUnknown(m) 162 } 163 164 var xxx_messageInfo_PrivateKey proto.InternalMessageInfo 165 166 func (m *PrivateKey) GetType() KeyType { 167 if m != nil { 168 return m.Type 169 } 170 return KeyType_RSA 171 } 172 173 func (m *PrivateKey) GetData() []byte { 174 if m != nil { 175 return m.Data 176 } 177 return nil 178 } 179 180 func init() { 181 proto.RegisterEnum("libp2pcrypto.pb.KeyType", KeyType_name, KeyType_value) 182 proto.RegisterType((*PublicKey)(nil), "libp2pcrypto.pb.PublicKey") 183 proto.RegisterType((*PrivateKey)(nil), "libp2pcrypto.pb.PrivateKey") 184 } 185 186 func init() { proto.RegisterFile("crypto.proto", fileDescriptor_527278fb02d03321) } 187 188 var fileDescriptor_527278fb02d03321 = []byte{ 189 // 258 bytes of a gzipped FileDescriptorProto 190 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x49, 0x2e, 0xaa, 0x2c, 191 0x28, 0xc9, 0xd7, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0xcf, 0xc9, 0x4c, 0x2a, 0x30, 0x2a, 192 0x80, 0x89, 0x25, 0x29, 0x45, 0x72, 0x71, 0x06, 0x94, 0x26, 0xe5, 0x64, 0x26, 0x7b, 0xa7, 0x56, 193 0x0a, 0x19, 0x71, 0xb1, 0x84, 0x54, 0x16, 0xa4, 0x4a, 0x30, 0x2a, 0x30, 0x69, 0xf0, 0x19, 0x49, 194 0xe8, 0xa1, 0x29, 0xd6, 0xf3, 0x4e, 0xad, 0x04, 0xc9, 0x3b, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x10, 195 0x04, 0x56, 0x2b, 0x24, 0xc1, 0xc5, 0xe2, 0x92, 0x58, 0x92, 0x28, 0xc1, 0xa4, 0xc0, 0xa4, 0xc1, 196 0x03, 0x93, 0x01, 0x89, 0x28, 0x45, 0x71, 0x71, 0x05, 0x14, 0x65, 0x96, 0x25, 0x96, 0xa4, 0x52, 197 0xdd, 0x6c, 0x2d, 0x27, 0x2e, 0x76, 0xa8, 0x06, 0x21, 0x76, 0x2e, 0xe6, 0xa0, 0x60, 0x47, 0x01, 198 0x06, 0x21, 0x6e, 0x2e, 0x76, 0xd7, 0x14, 0x23, 0x53, 0x53, 0x43, 0x4b, 0x01, 0x46, 0x21, 0x5e, 199 0x2e, 0xce, 0xe0, 0xd4, 0xe4, 0x02, 0x23, 0x53, 0xb3, 0x6c, 0x43, 0x01, 0x26, 0x21, 0x4e, 0x2e, 200 0x56, 0x57, 0x67, 0x97, 0x60, 0x47, 0x01, 0x66, 0x90, 0xfa, 0x60, 0x5f, 0x23, 0x01, 0x16, 0xa7, 201 0x90, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 202 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0xb2, 0x4a, 0xce, 0x48, 0xcc, 203 0xcc, 0xcb, 0x4d, 0xcc, 0x4e, 0x2d, 0xd2, 0xcb, 0x2f, 0x4a, 0xd7, 0x47, 0x70, 0x75, 0xd3, 0xf3, 204 0xf5, 0x93, 0xf3, 0x73, 0x73, 0xf3, 0xf3, 0xf4, 0x33, 0x52, 0x73, 0x0a, 0x52, 0x8b, 0xf4, 0x91, 205 0xfd, 0xa1, 0x5f, 0x90, 0x04, 0x08, 0x00, 0x00, 0xff, 0xff, 0x61, 0x5b, 0x9a, 0x49, 0x70, 0x01, 206 0x00, 0x00, 207 } 208 209 func (m *PublicKey) Marshal() (dAtA []byte, err error) { 210 size := m.Size() 211 dAtA = make([]byte, size) 212 n, err := m.MarshalToSizedBuffer(dAtA[:size]) 213 if err != nil { 214 return nil, err 215 } 216 return dAtA[:n], nil 217 } 218 219 func (m *PublicKey) MarshalTo(dAtA []byte) (int, error) { 220 size := m.Size() 221 return m.MarshalToSizedBuffer(dAtA[:size]) 222 } 223 224 func (m *PublicKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { 225 i := len(dAtA) 226 _ = i 227 var l int 228 _ = l 229 if m.Data != nil { 230 i -= len(m.Data) 231 copy(dAtA[i:], m.Data) 232 i = encodeVarintCrypto(dAtA, i, uint64(len(m.Data))) 233 i-- 234 dAtA[i] = 0x12 235 } 236 i = encodeVarintCrypto(dAtA, i, uint64(m.Type)) 237 i-- 238 dAtA[i] = 0x8 239 return len(dAtA) - i, nil 240 } 241 242 func (m *PrivateKey) Marshal() (dAtA []byte, err error) { 243 size := m.Size() 244 dAtA = make([]byte, size) 245 n, err := m.MarshalToSizedBuffer(dAtA[:size]) 246 if err != nil { 247 return nil, err 248 } 249 return dAtA[:n], nil 250 } 251 252 func (m *PrivateKey) MarshalTo(dAtA []byte) (int, error) { 253 size := m.Size() 254 return m.MarshalToSizedBuffer(dAtA[:size]) 255 } 256 257 func (m *PrivateKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { 258 i := len(dAtA) 259 _ = i 260 var l int 261 _ = l 262 if m.Data != nil { 263 i -= len(m.Data) 264 copy(dAtA[i:], m.Data) 265 i = encodeVarintCrypto(dAtA, i, uint64(len(m.Data))) 266 i-- 267 dAtA[i] = 0x12 268 } 269 i = encodeVarintCrypto(dAtA, i, uint64(m.Type)) 270 i-- 271 dAtA[i] = 0x8 272 return len(dAtA) - i, nil 273 } 274 275 func encodeVarintCrypto(dAtA []byte, offset int, v uint64) int { 276 offset -= sovCrypto(v) 277 base := offset 278 for v >= 1<<7 { 279 dAtA[offset] = uint8(v&0x7f | 0x80) 280 v >>= 7 281 offset++ 282 } 283 dAtA[offset] = uint8(v) 284 return base 285 } 286 func (m *PublicKey) Size() (n int) { 287 if m == nil { 288 return 0 289 } 290 var l int 291 _ = l 292 n += 1 + sovCrypto(uint64(m.Type)) 293 if m.Data != nil { 294 l = len(m.Data) 295 n += 1 + l + sovCrypto(uint64(l)) 296 } 297 return n 298 } 299 300 func (m *PrivateKey) Size() (n int) { 301 if m == nil { 302 return 0 303 } 304 var l int 305 _ = l 306 n += 1 + sovCrypto(uint64(m.Type)) 307 if m.Data != nil { 308 l = len(m.Data) 309 n += 1 + l + sovCrypto(uint64(l)) 310 } 311 return n 312 } 313 314 func sovCrypto(x uint64) (n int) { 315 return (math_bits.Len64(x|1) + 6) / 7 316 } 317 func sozCrypto(x uint64) (n int) { 318 return sovCrypto(uint64((x << 1) ^ uint64((int64(x) >> 63)))) 319 } 320 func (m *PublicKey) Unmarshal(dAtA []byte) error { 321 var hasFields [1]uint64 322 l := len(dAtA) 323 iNdEx := 0 324 for iNdEx < l { 325 preIndex := iNdEx 326 var wire uint64 327 for shift := uint(0); ; shift += 7 { 328 if shift >= 64 { 329 return ErrIntOverflowCrypto 330 } 331 if iNdEx >= l { 332 return io.ErrUnexpectedEOF 333 } 334 b := dAtA[iNdEx] 335 iNdEx++ 336 wire |= uint64(b&0x7F) << shift 337 if b < 0x80 { 338 break 339 } 340 } 341 fieldNum := int32(wire >> 3) 342 wireType := int(wire & 0x7) 343 if wireType == 4 { 344 return fmt.Errorf("proto: PublicKey: wiretype end group for non-group") 345 } 346 if fieldNum <= 0 { 347 return fmt.Errorf("proto: PublicKey: illegal tag %d (wire type %d)", fieldNum, wire) 348 } 349 switch fieldNum { 350 case 1: 351 if wireType != 0 { 352 return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) 353 } 354 m.Type = 0 355 for shift := uint(0); ; shift += 7 { 356 if shift >= 64 { 357 return ErrIntOverflowCrypto 358 } 359 if iNdEx >= l { 360 return io.ErrUnexpectedEOF 361 } 362 b := dAtA[iNdEx] 363 iNdEx++ 364 m.Type |= KeyType(b&0x7F) << shift 365 if b < 0x80 { 366 break 367 } 368 } 369 hasFields[0] |= uint64(0x00000001) 370 case 2: 371 if wireType != 2 { 372 return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) 373 } 374 var byteLen int 375 for shift := uint(0); ; shift += 7 { 376 if shift >= 64 { 377 return ErrIntOverflowCrypto 378 } 379 if iNdEx >= l { 380 return io.ErrUnexpectedEOF 381 } 382 b := dAtA[iNdEx] 383 iNdEx++ 384 byteLen |= int(b&0x7F) << shift 385 if b < 0x80 { 386 break 387 } 388 } 389 if byteLen < 0 { 390 return ErrInvalidLengthCrypto 391 } 392 postIndex := iNdEx + byteLen 393 if postIndex < 0 { 394 return ErrInvalidLengthCrypto 395 } 396 if postIndex > l { 397 return io.ErrUnexpectedEOF 398 } 399 m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) 400 if m.Data == nil { 401 m.Data = []byte{} 402 } 403 iNdEx = postIndex 404 hasFields[0] |= uint64(0x00000002) 405 default: 406 iNdEx = preIndex 407 skippy, err := skipCrypto(dAtA[iNdEx:]) 408 if err != nil { 409 return err 410 } 411 if skippy < 0 { 412 return ErrInvalidLengthCrypto 413 } 414 if (iNdEx + skippy) < 0 { 415 return ErrInvalidLengthCrypto 416 } 417 if (iNdEx + skippy) > l { 418 return io.ErrUnexpectedEOF 419 } 420 iNdEx += skippy 421 } 422 } 423 if hasFields[0]&uint64(0x00000001) == 0 { 424 return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Type") 425 } 426 if hasFields[0]&uint64(0x00000002) == 0 { 427 return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Data") 428 } 429 430 if iNdEx > l { 431 return io.ErrUnexpectedEOF 432 } 433 return nil 434 } 435 func (m *PrivateKey) Unmarshal(dAtA []byte) error { 436 var hasFields [1]uint64 437 l := len(dAtA) 438 iNdEx := 0 439 for iNdEx < l { 440 preIndex := iNdEx 441 var wire uint64 442 for shift := uint(0); ; shift += 7 { 443 if shift >= 64 { 444 return ErrIntOverflowCrypto 445 } 446 if iNdEx >= l { 447 return io.ErrUnexpectedEOF 448 } 449 b := dAtA[iNdEx] 450 iNdEx++ 451 wire |= uint64(b&0x7F) << shift 452 if b < 0x80 { 453 break 454 } 455 } 456 fieldNum := int32(wire >> 3) 457 wireType := int(wire & 0x7) 458 if wireType == 4 { 459 return fmt.Errorf("proto: PrivateKey: wiretype end group for non-group") 460 } 461 if fieldNum <= 0 { 462 return fmt.Errorf("proto: PrivateKey: illegal tag %d (wire type %d)", fieldNum, wire) 463 } 464 switch fieldNum { 465 case 1: 466 if wireType != 0 { 467 return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) 468 } 469 m.Type = 0 470 for shift := uint(0); ; shift += 7 { 471 if shift >= 64 { 472 return ErrIntOverflowCrypto 473 } 474 if iNdEx >= l { 475 return io.ErrUnexpectedEOF 476 } 477 b := dAtA[iNdEx] 478 iNdEx++ 479 m.Type |= KeyType(b&0x7F) << shift 480 if b < 0x80 { 481 break 482 } 483 } 484 hasFields[0] |= uint64(0x00000001) 485 case 2: 486 if wireType != 2 { 487 return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) 488 } 489 var byteLen int 490 for shift := uint(0); ; shift += 7 { 491 if shift >= 64 { 492 return ErrIntOverflowCrypto 493 } 494 if iNdEx >= l { 495 return io.ErrUnexpectedEOF 496 } 497 b := dAtA[iNdEx] 498 iNdEx++ 499 byteLen |= int(b&0x7F) << shift 500 if b < 0x80 { 501 break 502 } 503 } 504 if byteLen < 0 { 505 return ErrInvalidLengthCrypto 506 } 507 postIndex := iNdEx + byteLen 508 if postIndex < 0 { 509 return ErrInvalidLengthCrypto 510 } 511 if postIndex > l { 512 return io.ErrUnexpectedEOF 513 } 514 m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) 515 if m.Data == nil { 516 m.Data = []byte{} 517 } 518 iNdEx = postIndex 519 hasFields[0] |= uint64(0x00000002) 520 default: 521 iNdEx = preIndex 522 skippy, err := skipCrypto(dAtA[iNdEx:]) 523 if err != nil { 524 return err 525 } 526 if skippy < 0 { 527 return ErrInvalidLengthCrypto 528 } 529 if (iNdEx + skippy) < 0 { 530 return ErrInvalidLengthCrypto 531 } 532 if (iNdEx + skippy) > l { 533 return io.ErrUnexpectedEOF 534 } 535 iNdEx += skippy 536 } 537 } 538 if hasFields[0]&uint64(0x00000001) == 0 { 539 return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Type") 540 } 541 if hasFields[0]&uint64(0x00000002) == 0 { 542 return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Data") 543 } 544 545 if iNdEx > l { 546 return io.ErrUnexpectedEOF 547 } 548 return nil 549 } 550 func skipCrypto(dAtA []byte) (n int, err error) { 551 l := len(dAtA) 552 iNdEx := 0 553 depth := 0 554 for iNdEx < l { 555 var wire uint64 556 for shift := uint(0); ; shift += 7 { 557 if shift >= 64 { 558 return 0, ErrIntOverflowCrypto 559 } 560 if iNdEx >= l { 561 return 0, io.ErrUnexpectedEOF 562 } 563 b := dAtA[iNdEx] 564 iNdEx++ 565 wire |= (uint64(b) & 0x7F) << shift 566 if b < 0x80 { 567 break 568 } 569 } 570 wireType := int(wire & 0x7) 571 switch wireType { 572 case 0: 573 for shift := uint(0); ; shift += 7 { 574 if shift >= 64 { 575 return 0, ErrIntOverflowCrypto 576 } 577 if iNdEx >= l { 578 return 0, io.ErrUnexpectedEOF 579 } 580 iNdEx++ 581 if dAtA[iNdEx-1] < 0x80 { 582 break 583 } 584 } 585 case 1: 586 iNdEx += 8 587 case 2: 588 var length int 589 for shift := uint(0); ; shift += 7 { 590 if shift >= 64 { 591 return 0, ErrIntOverflowCrypto 592 } 593 if iNdEx >= l { 594 return 0, io.ErrUnexpectedEOF 595 } 596 b := dAtA[iNdEx] 597 iNdEx++ 598 length |= (int(b) & 0x7F) << shift 599 if b < 0x80 { 600 break 601 } 602 } 603 if length < 0 { 604 return 0, ErrInvalidLengthCrypto 605 } 606 iNdEx += length 607 case 3: 608 depth++ 609 case 4: 610 if depth == 0 { 611 return 0, ErrUnexpectedEndOfGroupCrypto 612 } 613 depth-- 614 case 5: 615 iNdEx += 4 616 default: 617 return 0, fmt.Errorf("proto: illegal wireType %d", wireType) 618 } 619 if iNdEx < 0 { 620 return 0, ErrInvalidLengthCrypto 621 } 622 if depth == 0 { 623 return iNdEx, nil 624 } 625 } 626 return 0, io.ErrUnexpectedEOF 627 } 628 629 var ( 630 ErrInvalidLengthCrypto = fmt.Errorf("proto: negative length found during unmarshaling") 631 ErrIntOverflowCrypto = fmt.Errorf("proto: integer overflow") 632 ErrUnexpectedEndOfGroupCrypto = fmt.Errorf("proto: unexpected end of group") 633 )