1 // Copyright 2024 Google LLC 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // This file is generated by rust-protobuf 3.2.0. Do not edit 16 // .proto file is parsed by protoc 3.21.12 17 // @generated 18 19 // https://github.com/rust-lang/rust-clippy/issues/702 20 #![allow(unknown_lints)] 21 #![allow(clippy::all)] 22 23 #![allow(unused_attributes)] 24 #![cfg_attr(rustfmt, rustfmt::skip)] 25 26 #![allow(box_pointers)] 27 #![allow(dead_code)] 28 #![allow(missing_docs)] 29 #![allow(non_camel_case_types)] 30 #![allow(non_snake_case)] 31 #![allow(non_upper_case_globals)] 32 #![allow(trivial_casts)] 33 #![allow(unused_results)] 34 #![allow(unused_mut)] 35 36 //! Generated file from `securemessage.proto` 37 // Generated for lite runtime 38 39 /// Generated files are compatible only with the same version 40 /// of protobuf runtime. 41 const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_2_0; 42 43 #[derive(PartialEq,Clone,Default,Debug)] 44 // @@protoc_insertion_point(message:securemessage.SecureMessage) 45 pub struct SecureMessage { 46 // message fields 47 // @@protoc_insertion_point(field:securemessage.SecureMessage.header_and_body) 48 pub header_and_body: ::std::option::Option<::std::vec::Vec<u8>>, 49 // @@protoc_insertion_point(field:securemessage.SecureMessage.signature) 50 pub signature: ::std::option::Option<::std::vec::Vec<u8>>, 51 // special fields 52 // @@protoc_insertion_point(special_field:securemessage.SecureMessage.special_fields) 53 pub special_fields: ::protobuf::SpecialFields, 54 } 55 56 impl<'a> ::std::default::Default for &'a SecureMessage { default() -> &'a SecureMessage57 fn default() -> &'a SecureMessage { 58 <SecureMessage as ::protobuf::Message>::default_instance() 59 } 60 } 61 62 impl SecureMessage { new() -> SecureMessage63 pub fn new() -> SecureMessage { 64 ::std::default::Default::default() 65 } 66 67 // required bytes header_and_body = 1; 68 header_and_body(&self) -> &[u8]69 pub fn header_and_body(&self) -> &[u8] { 70 match self.header_and_body.as_ref() { 71 Some(v) => v, 72 None => &[], 73 } 74 } 75 clear_header_and_body(&mut self)76 pub fn clear_header_and_body(&mut self) { 77 self.header_and_body = ::std::option::Option::None; 78 } 79 has_header_and_body(&self) -> bool80 pub fn has_header_and_body(&self) -> bool { 81 self.header_and_body.is_some() 82 } 83 84 // Param is passed by value, moved set_header_and_body(&mut self, v: ::std::vec::Vec<u8>)85 pub fn set_header_and_body(&mut self, v: ::std::vec::Vec<u8>) { 86 self.header_and_body = ::std::option::Option::Some(v); 87 } 88 89 // Mutable pointer to the field. 90 // If field is not initialized, it is initialized with default value first. mut_header_and_body(&mut self) -> &mut ::std::vec::Vec<u8>91 pub fn mut_header_and_body(&mut self) -> &mut ::std::vec::Vec<u8> { 92 if self.header_and_body.is_none() { 93 self.header_and_body = ::std::option::Option::Some(::std::vec::Vec::new()); 94 } 95 self.header_and_body.as_mut().unwrap() 96 } 97 98 // Take field take_header_and_body(&mut self) -> ::std::vec::Vec<u8>99 pub fn take_header_and_body(&mut self) -> ::std::vec::Vec<u8> { 100 self.header_and_body.take().unwrap_or_else(|| ::std::vec::Vec::new()) 101 } 102 103 // required bytes signature = 2; 104 signature(&self) -> &[u8]105 pub fn signature(&self) -> &[u8] { 106 match self.signature.as_ref() { 107 Some(v) => v, 108 None => &[], 109 } 110 } 111 clear_signature(&mut self)112 pub fn clear_signature(&mut self) { 113 self.signature = ::std::option::Option::None; 114 } 115 has_signature(&self) -> bool116 pub fn has_signature(&self) -> bool { 117 self.signature.is_some() 118 } 119 120 // Param is passed by value, moved set_signature(&mut self, v: ::std::vec::Vec<u8>)121 pub fn set_signature(&mut self, v: ::std::vec::Vec<u8>) { 122 self.signature = ::std::option::Option::Some(v); 123 } 124 125 // Mutable pointer to the field. 126 // If field is not initialized, it is initialized with default value first. mut_signature(&mut self) -> &mut ::std::vec::Vec<u8>127 pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec<u8> { 128 if self.signature.is_none() { 129 self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); 130 } 131 self.signature.as_mut().unwrap() 132 } 133 134 // Take field take_signature(&mut self) -> ::std::vec::Vec<u8>135 pub fn take_signature(&mut self) -> ::std::vec::Vec<u8> { 136 self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) 137 } 138 } 139 140 impl ::protobuf::Message for SecureMessage { 141 const NAME: &'static str = "SecureMessage"; 142 is_initialized(&self) -> bool143 fn is_initialized(&self) -> bool { 144 if self.header_and_body.is_none() { 145 return false; 146 } 147 if self.signature.is_none() { 148 return false; 149 } 150 true 151 } 152 merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()>153 fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { 154 while let Some(tag) = is.read_raw_tag_or_eof()? { 155 match tag { 156 10 => { 157 self.header_and_body = ::std::option::Option::Some(is.read_bytes()?); 158 }, 159 18 => { 160 self.signature = ::std::option::Option::Some(is.read_bytes()?); 161 }, 162 tag => { 163 ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; 164 }, 165 }; 166 } 167 ::std::result::Result::Ok(()) 168 } 169 170 // Compute sizes of nested messages 171 #[allow(unused_variables)] compute_size(&self) -> u64172 fn compute_size(&self) -> u64 { 173 let mut my_size = 0; 174 if let Some(v) = self.header_and_body.as_ref() { 175 my_size += ::protobuf::rt::bytes_size(1, &v); 176 } 177 if let Some(v) = self.signature.as_ref() { 178 my_size += ::protobuf::rt::bytes_size(2, &v); 179 } 180 my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); 181 self.special_fields.cached_size().set(my_size as u32); 182 my_size 183 } 184 write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()>185 fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { 186 if let Some(v) = self.header_and_body.as_ref() { 187 os.write_bytes(1, v)?; 188 } 189 if let Some(v) = self.signature.as_ref() { 190 os.write_bytes(2, v)?; 191 } 192 os.write_unknown_fields(self.special_fields.unknown_fields())?; 193 ::std::result::Result::Ok(()) 194 } 195 special_fields(&self) -> &::protobuf::SpecialFields196 fn special_fields(&self) -> &::protobuf::SpecialFields { 197 &self.special_fields 198 } 199 mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields200 fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { 201 &mut self.special_fields 202 } 203 new() -> SecureMessage204 fn new() -> SecureMessage { 205 SecureMessage::new() 206 } 207 clear(&mut self)208 fn clear(&mut self) { 209 self.header_and_body = ::std::option::Option::None; 210 self.signature = ::std::option::Option::None; 211 self.special_fields.clear(); 212 } 213 default_instance() -> &'static SecureMessage214 fn default_instance() -> &'static SecureMessage { 215 static instance: SecureMessage = SecureMessage { 216 header_and_body: ::std::option::Option::None, 217 signature: ::std::option::Option::None, 218 special_fields: ::protobuf::SpecialFields::new(), 219 }; 220 &instance 221 } 222 } 223 224 #[derive(PartialEq,Clone,Default,Debug)] 225 // @@protoc_insertion_point(message:securemessage.Header) 226 pub struct Header { 227 // message fields 228 // @@protoc_insertion_point(field:securemessage.Header.signature_scheme) 229 pub signature_scheme: ::std::option::Option<::protobuf::EnumOrUnknown<SigScheme>>, 230 // @@protoc_insertion_point(field:securemessage.Header.encryption_scheme) 231 pub encryption_scheme: ::std::option::Option<::protobuf::EnumOrUnknown<EncScheme>>, 232 // @@protoc_insertion_point(field:securemessage.Header.verification_key_id) 233 pub verification_key_id: ::std::option::Option<::std::vec::Vec<u8>>, 234 // @@protoc_insertion_point(field:securemessage.Header.decryption_key_id) 235 pub decryption_key_id: ::std::option::Option<::std::vec::Vec<u8>>, 236 // @@protoc_insertion_point(field:securemessage.Header.iv) 237 pub iv: ::std::option::Option<::std::vec::Vec<u8>>, 238 // @@protoc_insertion_point(field:securemessage.Header.public_metadata) 239 pub public_metadata: ::std::option::Option<::std::vec::Vec<u8>>, 240 // @@protoc_insertion_point(field:securemessage.Header.associated_data_length) 241 pub associated_data_length: ::std::option::Option<u32>, 242 // @@protoc_insertion_point(field:securemessage.Header.nonce) 243 pub nonce: ::std::option::Option<::std::vec::Vec<u8>>, 244 // special fields 245 // @@protoc_insertion_point(special_field:securemessage.Header.special_fields) 246 pub special_fields: ::protobuf::SpecialFields, 247 } 248 249 impl<'a> ::std::default::Default for &'a Header { default() -> &'a Header250 fn default() -> &'a Header { 251 <Header as ::protobuf::Message>::default_instance() 252 } 253 } 254 255 impl Header { new() -> Header256 pub fn new() -> Header { 257 ::std::default::Default::default() 258 } 259 260 // required .securemessage.SigScheme signature_scheme = 1; 261 signature_scheme(&self) -> SigScheme262 pub fn signature_scheme(&self) -> SigScheme { 263 match self.signature_scheme { 264 Some(e) => e.enum_value_or(SigScheme::HMAC_SHA256), 265 None => SigScheme::HMAC_SHA256, 266 } 267 } 268 clear_signature_scheme(&mut self)269 pub fn clear_signature_scheme(&mut self) { 270 self.signature_scheme = ::std::option::Option::None; 271 } 272 has_signature_scheme(&self) -> bool273 pub fn has_signature_scheme(&self) -> bool { 274 self.signature_scheme.is_some() 275 } 276 277 // Param is passed by value, moved set_signature_scheme(&mut self, v: SigScheme)278 pub fn set_signature_scheme(&mut self, v: SigScheme) { 279 self.signature_scheme = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); 280 } 281 282 // required .securemessage.EncScheme encryption_scheme = 2; 283 encryption_scheme(&self) -> EncScheme284 pub fn encryption_scheme(&self) -> EncScheme { 285 match self.encryption_scheme { 286 Some(e) => e.enum_value_or(EncScheme::NONE), 287 None => EncScheme::NONE, 288 } 289 } 290 clear_encryption_scheme(&mut self)291 pub fn clear_encryption_scheme(&mut self) { 292 self.encryption_scheme = ::std::option::Option::None; 293 } 294 has_encryption_scheme(&self) -> bool295 pub fn has_encryption_scheme(&self) -> bool { 296 self.encryption_scheme.is_some() 297 } 298 299 // Param is passed by value, moved set_encryption_scheme(&mut self, v: EncScheme)300 pub fn set_encryption_scheme(&mut self, v: EncScheme) { 301 self.encryption_scheme = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); 302 } 303 304 // optional bytes verification_key_id = 3; 305 verification_key_id(&self) -> &[u8]306 pub fn verification_key_id(&self) -> &[u8] { 307 match self.verification_key_id.as_ref() { 308 Some(v) => v, 309 None => &[], 310 } 311 } 312 clear_verification_key_id(&mut self)313 pub fn clear_verification_key_id(&mut self) { 314 self.verification_key_id = ::std::option::Option::None; 315 } 316 has_verification_key_id(&self) -> bool317 pub fn has_verification_key_id(&self) -> bool { 318 self.verification_key_id.is_some() 319 } 320 321 // Param is passed by value, moved set_verification_key_id(&mut self, v: ::std::vec::Vec<u8>)322 pub fn set_verification_key_id(&mut self, v: ::std::vec::Vec<u8>) { 323 self.verification_key_id = ::std::option::Option::Some(v); 324 } 325 326 // Mutable pointer to the field. 327 // If field is not initialized, it is initialized with default value first. mut_verification_key_id(&mut self) -> &mut ::std::vec::Vec<u8>328 pub fn mut_verification_key_id(&mut self) -> &mut ::std::vec::Vec<u8> { 329 if self.verification_key_id.is_none() { 330 self.verification_key_id = ::std::option::Option::Some(::std::vec::Vec::new()); 331 } 332 self.verification_key_id.as_mut().unwrap() 333 } 334 335 // Take field take_verification_key_id(&mut self) -> ::std::vec::Vec<u8>336 pub fn take_verification_key_id(&mut self) -> ::std::vec::Vec<u8> { 337 self.verification_key_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) 338 } 339 340 // optional bytes decryption_key_id = 4; 341 decryption_key_id(&self) -> &[u8]342 pub fn decryption_key_id(&self) -> &[u8] { 343 match self.decryption_key_id.as_ref() { 344 Some(v) => v, 345 None => &[], 346 } 347 } 348 clear_decryption_key_id(&mut self)349 pub fn clear_decryption_key_id(&mut self) { 350 self.decryption_key_id = ::std::option::Option::None; 351 } 352 has_decryption_key_id(&self) -> bool353 pub fn has_decryption_key_id(&self) -> bool { 354 self.decryption_key_id.is_some() 355 } 356 357 // Param is passed by value, moved set_decryption_key_id(&mut self, v: ::std::vec::Vec<u8>)358 pub fn set_decryption_key_id(&mut self, v: ::std::vec::Vec<u8>) { 359 self.decryption_key_id = ::std::option::Option::Some(v); 360 } 361 362 // Mutable pointer to the field. 363 // If field is not initialized, it is initialized with default value first. mut_decryption_key_id(&mut self) -> &mut ::std::vec::Vec<u8>364 pub fn mut_decryption_key_id(&mut self) -> &mut ::std::vec::Vec<u8> { 365 if self.decryption_key_id.is_none() { 366 self.decryption_key_id = ::std::option::Option::Some(::std::vec::Vec::new()); 367 } 368 self.decryption_key_id.as_mut().unwrap() 369 } 370 371 // Take field take_decryption_key_id(&mut self) -> ::std::vec::Vec<u8>372 pub fn take_decryption_key_id(&mut self) -> ::std::vec::Vec<u8> { 373 self.decryption_key_id.take().unwrap_or_else(|| ::std::vec::Vec::new()) 374 } 375 376 // optional bytes iv = 5; 377 iv(&self) -> &[u8]378 pub fn iv(&self) -> &[u8] { 379 match self.iv.as_ref() { 380 Some(v) => v, 381 None => &[], 382 } 383 } 384 clear_iv(&mut self)385 pub fn clear_iv(&mut self) { 386 self.iv = ::std::option::Option::None; 387 } 388 has_iv(&self) -> bool389 pub fn has_iv(&self) -> bool { 390 self.iv.is_some() 391 } 392 393 // Param is passed by value, moved set_iv(&mut self, v: ::std::vec::Vec<u8>)394 pub fn set_iv(&mut self, v: ::std::vec::Vec<u8>) { 395 self.iv = ::std::option::Option::Some(v); 396 } 397 398 // Mutable pointer to the field. 399 // If field is not initialized, it is initialized with default value first. mut_iv(&mut self) -> &mut ::std::vec::Vec<u8>400 pub fn mut_iv(&mut self) -> &mut ::std::vec::Vec<u8> { 401 if self.iv.is_none() { 402 self.iv = ::std::option::Option::Some(::std::vec::Vec::new()); 403 } 404 self.iv.as_mut().unwrap() 405 } 406 407 // Take field take_iv(&mut self) -> ::std::vec::Vec<u8>408 pub fn take_iv(&mut self) -> ::std::vec::Vec<u8> { 409 self.iv.take().unwrap_or_else(|| ::std::vec::Vec::new()) 410 } 411 412 // optional bytes public_metadata = 6; 413 public_metadata(&self) -> &[u8]414 pub fn public_metadata(&self) -> &[u8] { 415 match self.public_metadata.as_ref() { 416 Some(v) => v, 417 None => &[], 418 } 419 } 420 clear_public_metadata(&mut self)421 pub fn clear_public_metadata(&mut self) { 422 self.public_metadata = ::std::option::Option::None; 423 } 424 has_public_metadata(&self) -> bool425 pub fn has_public_metadata(&self) -> bool { 426 self.public_metadata.is_some() 427 } 428 429 // Param is passed by value, moved set_public_metadata(&mut self, v: ::std::vec::Vec<u8>)430 pub fn set_public_metadata(&mut self, v: ::std::vec::Vec<u8>) { 431 self.public_metadata = ::std::option::Option::Some(v); 432 } 433 434 // Mutable pointer to the field. 435 // If field is not initialized, it is initialized with default value first. mut_public_metadata(&mut self) -> &mut ::std::vec::Vec<u8>436 pub fn mut_public_metadata(&mut self) -> &mut ::std::vec::Vec<u8> { 437 if self.public_metadata.is_none() { 438 self.public_metadata = ::std::option::Option::Some(::std::vec::Vec::new()); 439 } 440 self.public_metadata.as_mut().unwrap() 441 } 442 443 // Take field take_public_metadata(&mut self) -> ::std::vec::Vec<u8>444 pub fn take_public_metadata(&mut self) -> ::std::vec::Vec<u8> { 445 self.public_metadata.take().unwrap_or_else(|| ::std::vec::Vec::new()) 446 } 447 448 // optional uint32 associated_data_length = 7; 449 associated_data_length(&self) -> u32450 pub fn associated_data_length(&self) -> u32 { 451 self.associated_data_length.unwrap_or(0u32) 452 } 453 clear_associated_data_length(&mut self)454 pub fn clear_associated_data_length(&mut self) { 455 self.associated_data_length = ::std::option::Option::None; 456 } 457 has_associated_data_length(&self) -> bool458 pub fn has_associated_data_length(&self) -> bool { 459 self.associated_data_length.is_some() 460 } 461 462 // Param is passed by value, moved set_associated_data_length(&mut self, v: u32)463 pub fn set_associated_data_length(&mut self, v: u32) { 464 self.associated_data_length = ::std::option::Option::Some(v); 465 } 466 467 // optional bytes nonce = 8; 468 nonce(&self) -> &[u8]469 pub fn nonce(&self) -> &[u8] { 470 match self.nonce.as_ref() { 471 Some(v) => v, 472 None => &[], 473 } 474 } 475 clear_nonce(&mut self)476 pub fn clear_nonce(&mut self) { 477 self.nonce = ::std::option::Option::None; 478 } 479 has_nonce(&self) -> bool480 pub fn has_nonce(&self) -> bool { 481 self.nonce.is_some() 482 } 483 484 // Param is passed by value, moved set_nonce(&mut self, v: ::std::vec::Vec<u8>)485 pub fn set_nonce(&mut self, v: ::std::vec::Vec<u8>) { 486 self.nonce = ::std::option::Option::Some(v); 487 } 488 489 // Mutable pointer to the field. 490 // If field is not initialized, it is initialized with default value first. mut_nonce(&mut self) -> &mut ::std::vec::Vec<u8>491 pub fn mut_nonce(&mut self) -> &mut ::std::vec::Vec<u8> { 492 if self.nonce.is_none() { 493 self.nonce = ::std::option::Option::Some(::std::vec::Vec::new()); 494 } 495 self.nonce.as_mut().unwrap() 496 } 497 498 // Take field take_nonce(&mut self) -> ::std::vec::Vec<u8>499 pub fn take_nonce(&mut self) -> ::std::vec::Vec<u8> { 500 self.nonce.take().unwrap_or_else(|| ::std::vec::Vec::new()) 501 } 502 } 503 504 impl ::protobuf::Message for Header { 505 const NAME: &'static str = "Header"; 506 is_initialized(&self) -> bool507 fn is_initialized(&self) -> bool { 508 if self.signature_scheme.is_none() { 509 return false; 510 } 511 if self.encryption_scheme.is_none() { 512 return false; 513 } 514 true 515 } 516 merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()>517 fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { 518 while let Some(tag) = is.read_raw_tag_or_eof()? { 519 match tag { 520 8 => { 521 self.signature_scheme = ::std::option::Option::Some(is.read_enum_or_unknown()?); 522 }, 523 16 => { 524 self.encryption_scheme = ::std::option::Option::Some(is.read_enum_or_unknown()?); 525 }, 526 26 => { 527 self.verification_key_id = ::std::option::Option::Some(is.read_bytes()?); 528 }, 529 34 => { 530 self.decryption_key_id = ::std::option::Option::Some(is.read_bytes()?); 531 }, 532 42 => { 533 self.iv = ::std::option::Option::Some(is.read_bytes()?); 534 }, 535 50 => { 536 self.public_metadata = ::std::option::Option::Some(is.read_bytes()?); 537 }, 538 56 => { 539 self.associated_data_length = ::std::option::Option::Some(is.read_uint32()?); 540 }, 541 66 => { 542 self.nonce = ::std::option::Option::Some(is.read_bytes()?); 543 }, 544 tag => { 545 ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; 546 }, 547 }; 548 } 549 ::std::result::Result::Ok(()) 550 } 551 552 // Compute sizes of nested messages 553 #[allow(unused_variables)] compute_size(&self) -> u64554 fn compute_size(&self) -> u64 { 555 let mut my_size = 0; 556 if let Some(v) = self.signature_scheme { 557 my_size += ::protobuf::rt::int32_size(1, v.value()); 558 } 559 if let Some(v) = self.encryption_scheme { 560 my_size += ::protobuf::rt::int32_size(2, v.value()); 561 } 562 if let Some(v) = self.verification_key_id.as_ref() { 563 my_size += ::protobuf::rt::bytes_size(3, &v); 564 } 565 if let Some(v) = self.decryption_key_id.as_ref() { 566 my_size += ::protobuf::rt::bytes_size(4, &v); 567 } 568 if let Some(v) = self.iv.as_ref() { 569 my_size += ::protobuf::rt::bytes_size(5, &v); 570 } 571 if let Some(v) = self.public_metadata.as_ref() { 572 my_size += ::protobuf::rt::bytes_size(6, &v); 573 } 574 if let Some(v) = self.associated_data_length { 575 my_size += ::protobuf::rt::uint32_size(7, v); 576 } 577 if let Some(v) = self.nonce.as_ref() { 578 my_size += ::protobuf::rt::bytes_size(8, &v); 579 } 580 my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); 581 self.special_fields.cached_size().set(my_size as u32); 582 my_size 583 } 584 write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()>585 fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { 586 if let Some(v) = self.signature_scheme { 587 os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; 588 } 589 if let Some(v) = self.encryption_scheme { 590 os.write_enum(2, ::protobuf::EnumOrUnknown::value(&v))?; 591 } 592 if let Some(v) = self.verification_key_id.as_ref() { 593 os.write_bytes(3, v)?; 594 } 595 if let Some(v) = self.decryption_key_id.as_ref() { 596 os.write_bytes(4, v)?; 597 } 598 if let Some(v) = self.iv.as_ref() { 599 os.write_bytes(5, v)?; 600 } 601 if let Some(v) = self.public_metadata.as_ref() { 602 os.write_bytes(6, v)?; 603 } 604 if let Some(v) = self.associated_data_length { 605 os.write_uint32(7, v)?; 606 } 607 if let Some(v) = self.nonce.as_ref() { 608 os.write_bytes(8, v)?; 609 } 610 os.write_unknown_fields(self.special_fields.unknown_fields())?; 611 ::std::result::Result::Ok(()) 612 } 613 special_fields(&self) -> &::protobuf::SpecialFields614 fn special_fields(&self) -> &::protobuf::SpecialFields { 615 &self.special_fields 616 } 617 mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields618 fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { 619 &mut self.special_fields 620 } 621 new() -> Header622 fn new() -> Header { 623 Header::new() 624 } 625 clear(&mut self)626 fn clear(&mut self) { 627 self.signature_scheme = ::std::option::Option::None; 628 self.encryption_scheme = ::std::option::Option::None; 629 self.verification_key_id = ::std::option::Option::None; 630 self.decryption_key_id = ::std::option::Option::None; 631 self.iv = ::std::option::Option::None; 632 self.public_metadata = ::std::option::Option::None; 633 self.associated_data_length = ::std::option::Option::None; 634 self.nonce = ::std::option::Option::None; 635 self.special_fields.clear(); 636 } 637 default_instance() -> &'static Header638 fn default_instance() -> &'static Header { 639 static instance: Header = Header { 640 signature_scheme: ::std::option::Option::None, 641 encryption_scheme: ::std::option::Option::None, 642 verification_key_id: ::std::option::Option::None, 643 decryption_key_id: ::std::option::Option::None, 644 iv: ::std::option::Option::None, 645 public_metadata: ::std::option::Option::None, 646 associated_data_length: ::std::option::Option::None, 647 nonce: ::std::option::Option::None, 648 special_fields: ::protobuf::SpecialFields::new(), 649 }; 650 &instance 651 } 652 } 653 654 #[derive(PartialEq,Clone,Default,Debug)] 655 // @@protoc_insertion_point(message:securemessage.HeaderAndBody) 656 pub struct HeaderAndBody { 657 // message fields 658 // @@protoc_insertion_point(field:securemessage.HeaderAndBody.header) 659 pub header: ::protobuf::MessageField<Header>, 660 // @@protoc_insertion_point(field:securemessage.HeaderAndBody.body) 661 pub body: ::std::option::Option<::std::vec::Vec<u8>>, 662 // special fields 663 // @@protoc_insertion_point(special_field:securemessage.HeaderAndBody.special_fields) 664 pub special_fields: ::protobuf::SpecialFields, 665 } 666 667 impl<'a> ::std::default::Default for &'a HeaderAndBody { default() -> &'a HeaderAndBody668 fn default() -> &'a HeaderAndBody { 669 <HeaderAndBody as ::protobuf::Message>::default_instance() 670 } 671 } 672 673 impl HeaderAndBody { new() -> HeaderAndBody674 pub fn new() -> HeaderAndBody { 675 ::std::default::Default::default() 676 } 677 678 // required bytes body = 2; 679 body(&self) -> &[u8]680 pub fn body(&self) -> &[u8] { 681 match self.body.as_ref() { 682 Some(v) => v, 683 None => &[], 684 } 685 } 686 clear_body(&mut self)687 pub fn clear_body(&mut self) { 688 self.body = ::std::option::Option::None; 689 } 690 has_body(&self) -> bool691 pub fn has_body(&self) -> bool { 692 self.body.is_some() 693 } 694 695 // Param is passed by value, moved set_body(&mut self, v: ::std::vec::Vec<u8>)696 pub fn set_body(&mut self, v: ::std::vec::Vec<u8>) { 697 self.body = ::std::option::Option::Some(v); 698 } 699 700 // Mutable pointer to the field. 701 // If field is not initialized, it is initialized with default value first. mut_body(&mut self) -> &mut ::std::vec::Vec<u8>702 pub fn mut_body(&mut self) -> &mut ::std::vec::Vec<u8> { 703 if self.body.is_none() { 704 self.body = ::std::option::Option::Some(::std::vec::Vec::new()); 705 } 706 self.body.as_mut().unwrap() 707 } 708 709 // Take field take_body(&mut self) -> ::std::vec::Vec<u8>710 pub fn take_body(&mut self) -> ::std::vec::Vec<u8> { 711 self.body.take().unwrap_or_else(|| ::std::vec::Vec::new()) 712 } 713 } 714 715 impl ::protobuf::Message for HeaderAndBody { 716 const NAME: &'static str = "HeaderAndBody"; 717 is_initialized(&self) -> bool718 fn is_initialized(&self) -> bool { 719 if self.header.is_none() { 720 return false; 721 } 722 if self.body.is_none() { 723 return false; 724 } 725 for v in &self.header { 726 if !v.is_initialized() { 727 return false; 728 } 729 }; 730 true 731 } 732 merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()>733 fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { 734 while let Some(tag) = is.read_raw_tag_or_eof()? { 735 match tag { 736 10 => { 737 ::protobuf::rt::read_singular_message_into_field(is, &mut self.header)?; 738 }, 739 18 => { 740 self.body = ::std::option::Option::Some(is.read_bytes()?); 741 }, 742 tag => { 743 ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; 744 }, 745 }; 746 } 747 ::std::result::Result::Ok(()) 748 } 749 750 // Compute sizes of nested messages 751 #[allow(unused_variables)] compute_size(&self) -> u64752 fn compute_size(&self) -> u64 { 753 let mut my_size = 0; 754 if let Some(v) = self.header.as_ref() { 755 let len = v.compute_size(); 756 my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; 757 } 758 if let Some(v) = self.body.as_ref() { 759 my_size += ::protobuf::rt::bytes_size(2, &v); 760 } 761 my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); 762 self.special_fields.cached_size().set(my_size as u32); 763 my_size 764 } 765 write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()>766 fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { 767 if let Some(v) = self.header.as_ref() { 768 ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; 769 } 770 if let Some(v) = self.body.as_ref() { 771 os.write_bytes(2, v)?; 772 } 773 os.write_unknown_fields(self.special_fields.unknown_fields())?; 774 ::std::result::Result::Ok(()) 775 } 776 special_fields(&self) -> &::protobuf::SpecialFields777 fn special_fields(&self) -> &::protobuf::SpecialFields { 778 &self.special_fields 779 } 780 mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields781 fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { 782 &mut self.special_fields 783 } 784 new() -> HeaderAndBody785 fn new() -> HeaderAndBody { 786 HeaderAndBody::new() 787 } 788 clear(&mut self)789 fn clear(&mut self) { 790 self.header.clear(); 791 self.body = ::std::option::Option::None; 792 self.special_fields.clear(); 793 } 794 default_instance() -> &'static HeaderAndBody795 fn default_instance() -> &'static HeaderAndBody { 796 static instance: HeaderAndBody = HeaderAndBody { 797 header: ::protobuf::MessageField::none(), 798 body: ::std::option::Option::None, 799 special_fields: ::protobuf::SpecialFields::new(), 800 }; 801 &instance 802 } 803 } 804 805 #[derive(PartialEq,Clone,Default,Debug)] 806 // @@protoc_insertion_point(message:securemessage.EcP256PublicKey) 807 pub struct EcP256PublicKey { 808 // message fields 809 // @@protoc_insertion_point(field:securemessage.EcP256PublicKey.x) 810 pub x: ::std::option::Option<::std::vec::Vec<u8>>, 811 // @@protoc_insertion_point(field:securemessage.EcP256PublicKey.y) 812 pub y: ::std::option::Option<::std::vec::Vec<u8>>, 813 // special fields 814 // @@protoc_insertion_point(special_field:securemessage.EcP256PublicKey.special_fields) 815 pub special_fields: ::protobuf::SpecialFields, 816 } 817 818 impl<'a> ::std::default::Default for &'a EcP256PublicKey { default() -> &'a EcP256PublicKey819 fn default() -> &'a EcP256PublicKey { 820 <EcP256PublicKey as ::protobuf::Message>::default_instance() 821 } 822 } 823 824 impl EcP256PublicKey { new() -> EcP256PublicKey825 pub fn new() -> EcP256PublicKey { 826 ::std::default::Default::default() 827 } 828 829 // required bytes x = 1; 830 x(&self) -> &[u8]831 pub fn x(&self) -> &[u8] { 832 match self.x.as_ref() { 833 Some(v) => v, 834 None => &[], 835 } 836 } 837 clear_x(&mut self)838 pub fn clear_x(&mut self) { 839 self.x = ::std::option::Option::None; 840 } 841 has_x(&self) -> bool842 pub fn has_x(&self) -> bool { 843 self.x.is_some() 844 } 845 846 // Param is passed by value, moved set_x(&mut self, v: ::std::vec::Vec<u8>)847 pub fn set_x(&mut self, v: ::std::vec::Vec<u8>) { 848 self.x = ::std::option::Option::Some(v); 849 } 850 851 // Mutable pointer to the field. 852 // If field is not initialized, it is initialized with default value first. mut_x(&mut self) -> &mut ::std::vec::Vec<u8>853 pub fn mut_x(&mut self) -> &mut ::std::vec::Vec<u8> { 854 if self.x.is_none() { 855 self.x = ::std::option::Option::Some(::std::vec::Vec::new()); 856 } 857 self.x.as_mut().unwrap() 858 } 859 860 // Take field take_x(&mut self) -> ::std::vec::Vec<u8>861 pub fn take_x(&mut self) -> ::std::vec::Vec<u8> { 862 self.x.take().unwrap_or_else(|| ::std::vec::Vec::new()) 863 } 864 865 // required bytes y = 2; 866 y(&self) -> &[u8]867 pub fn y(&self) -> &[u8] { 868 match self.y.as_ref() { 869 Some(v) => v, 870 None => &[], 871 } 872 } 873 clear_y(&mut self)874 pub fn clear_y(&mut self) { 875 self.y = ::std::option::Option::None; 876 } 877 has_y(&self) -> bool878 pub fn has_y(&self) -> bool { 879 self.y.is_some() 880 } 881 882 // Param is passed by value, moved set_y(&mut self, v: ::std::vec::Vec<u8>)883 pub fn set_y(&mut self, v: ::std::vec::Vec<u8>) { 884 self.y = ::std::option::Option::Some(v); 885 } 886 887 // Mutable pointer to the field. 888 // If field is not initialized, it is initialized with default value first. mut_y(&mut self) -> &mut ::std::vec::Vec<u8>889 pub fn mut_y(&mut self) -> &mut ::std::vec::Vec<u8> { 890 if self.y.is_none() { 891 self.y = ::std::option::Option::Some(::std::vec::Vec::new()); 892 } 893 self.y.as_mut().unwrap() 894 } 895 896 // Take field take_y(&mut self) -> ::std::vec::Vec<u8>897 pub fn take_y(&mut self) -> ::std::vec::Vec<u8> { 898 self.y.take().unwrap_or_else(|| ::std::vec::Vec::new()) 899 } 900 } 901 902 impl ::protobuf::Message for EcP256PublicKey { 903 const NAME: &'static str = "EcP256PublicKey"; 904 is_initialized(&self) -> bool905 fn is_initialized(&self) -> bool { 906 if self.x.is_none() { 907 return false; 908 } 909 if self.y.is_none() { 910 return false; 911 } 912 true 913 } 914 merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()>915 fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { 916 while let Some(tag) = is.read_raw_tag_or_eof()? { 917 match tag { 918 10 => { 919 self.x = ::std::option::Option::Some(is.read_bytes()?); 920 }, 921 18 => { 922 self.y = ::std::option::Option::Some(is.read_bytes()?); 923 }, 924 tag => { 925 ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; 926 }, 927 }; 928 } 929 ::std::result::Result::Ok(()) 930 } 931 932 // Compute sizes of nested messages 933 #[allow(unused_variables)] compute_size(&self) -> u64934 fn compute_size(&self) -> u64 { 935 let mut my_size = 0; 936 if let Some(v) = self.x.as_ref() { 937 my_size += ::protobuf::rt::bytes_size(1, &v); 938 } 939 if let Some(v) = self.y.as_ref() { 940 my_size += ::protobuf::rt::bytes_size(2, &v); 941 } 942 my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); 943 self.special_fields.cached_size().set(my_size as u32); 944 my_size 945 } 946 write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()>947 fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { 948 if let Some(v) = self.x.as_ref() { 949 os.write_bytes(1, v)?; 950 } 951 if let Some(v) = self.y.as_ref() { 952 os.write_bytes(2, v)?; 953 } 954 os.write_unknown_fields(self.special_fields.unknown_fields())?; 955 ::std::result::Result::Ok(()) 956 } 957 special_fields(&self) -> &::protobuf::SpecialFields958 fn special_fields(&self) -> &::protobuf::SpecialFields { 959 &self.special_fields 960 } 961 mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields962 fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { 963 &mut self.special_fields 964 } 965 new() -> EcP256PublicKey966 fn new() -> EcP256PublicKey { 967 EcP256PublicKey::new() 968 } 969 clear(&mut self)970 fn clear(&mut self) { 971 self.x = ::std::option::Option::None; 972 self.y = ::std::option::Option::None; 973 self.special_fields.clear(); 974 } 975 default_instance() -> &'static EcP256PublicKey976 fn default_instance() -> &'static EcP256PublicKey { 977 static instance: EcP256PublicKey = EcP256PublicKey { 978 x: ::std::option::Option::None, 979 y: ::std::option::Option::None, 980 special_fields: ::protobuf::SpecialFields::new(), 981 }; 982 &instance 983 } 984 } 985 986 #[derive(PartialEq,Clone,Default,Debug)] 987 // @@protoc_insertion_point(message:securemessage.SimpleRsaPublicKey) 988 pub struct SimpleRsaPublicKey { 989 // message fields 990 // @@protoc_insertion_point(field:securemessage.SimpleRsaPublicKey.n) 991 pub n: ::std::option::Option<::std::vec::Vec<u8>>, 992 // @@protoc_insertion_point(field:securemessage.SimpleRsaPublicKey.e) 993 pub e: ::std::option::Option<i32>, 994 // special fields 995 // @@protoc_insertion_point(special_field:securemessage.SimpleRsaPublicKey.special_fields) 996 pub special_fields: ::protobuf::SpecialFields, 997 } 998 999 impl<'a> ::std::default::Default for &'a SimpleRsaPublicKey { default() -> &'a SimpleRsaPublicKey1000 fn default() -> &'a SimpleRsaPublicKey { 1001 <SimpleRsaPublicKey as ::protobuf::Message>::default_instance() 1002 } 1003 } 1004 1005 impl SimpleRsaPublicKey { new() -> SimpleRsaPublicKey1006 pub fn new() -> SimpleRsaPublicKey { 1007 ::std::default::Default::default() 1008 } 1009 1010 // required bytes n = 1; 1011 n(&self) -> &[u8]1012 pub fn n(&self) -> &[u8] { 1013 match self.n.as_ref() { 1014 Some(v) => v, 1015 None => &[], 1016 } 1017 } 1018 clear_n(&mut self)1019 pub fn clear_n(&mut self) { 1020 self.n = ::std::option::Option::None; 1021 } 1022 has_n(&self) -> bool1023 pub fn has_n(&self) -> bool { 1024 self.n.is_some() 1025 } 1026 1027 // Param is passed by value, moved set_n(&mut self, v: ::std::vec::Vec<u8>)1028 pub fn set_n(&mut self, v: ::std::vec::Vec<u8>) { 1029 self.n = ::std::option::Option::Some(v); 1030 } 1031 1032 // Mutable pointer to the field. 1033 // If field is not initialized, it is initialized with default value first. mut_n(&mut self) -> &mut ::std::vec::Vec<u8>1034 pub fn mut_n(&mut self) -> &mut ::std::vec::Vec<u8> { 1035 if self.n.is_none() { 1036 self.n = ::std::option::Option::Some(::std::vec::Vec::new()); 1037 } 1038 self.n.as_mut().unwrap() 1039 } 1040 1041 // Take field take_n(&mut self) -> ::std::vec::Vec<u8>1042 pub fn take_n(&mut self) -> ::std::vec::Vec<u8> { 1043 self.n.take().unwrap_or_else(|| ::std::vec::Vec::new()) 1044 } 1045 1046 // optional int32 e = 2; 1047 e(&self) -> i321048 pub fn e(&self) -> i32 { 1049 self.e.unwrap_or(65537i32) 1050 } 1051 clear_e(&mut self)1052 pub fn clear_e(&mut self) { 1053 self.e = ::std::option::Option::None; 1054 } 1055 has_e(&self) -> bool1056 pub fn has_e(&self) -> bool { 1057 self.e.is_some() 1058 } 1059 1060 // Param is passed by value, moved set_e(&mut self, v: i32)1061 pub fn set_e(&mut self, v: i32) { 1062 self.e = ::std::option::Option::Some(v); 1063 } 1064 } 1065 1066 impl ::protobuf::Message for SimpleRsaPublicKey { 1067 const NAME: &'static str = "SimpleRsaPublicKey"; 1068 is_initialized(&self) -> bool1069 fn is_initialized(&self) -> bool { 1070 if self.n.is_none() { 1071 return false; 1072 } 1073 true 1074 } 1075 merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()>1076 fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { 1077 while let Some(tag) = is.read_raw_tag_or_eof()? { 1078 match tag { 1079 10 => { 1080 self.n = ::std::option::Option::Some(is.read_bytes()?); 1081 }, 1082 16 => { 1083 self.e = ::std::option::Option::Some(is.read_int32()?); 1084 }, 1085 tag => { 1086 ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; 1087 }, 1088 }; 1089 } 1090 ::std::result::Result::Ok(()) 1091 } 1092 1093 // Compute sizes of nested messages 1094 #[allow(unused_variables)] compute_size(&self) -> u641095 fn compute_size(&self) -> u64 { 1096 let mut my_size = 0; 1097 if let Some(v) = self.n.as_ref() { 1098 my_size += ::protobuf::rt::bytes_size(1, &v); 1099 } 1100 if let Some(v) = self.e { 1101 my_size += ::protobuf::rt::int32_size(2, v); 1102 } 1103 my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); 1104 self.special_fields.cached_size().set(my_size as u32); 1105 my_size 1106 } 1107 write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()>1108 fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { 1109 if let Some(v) = self.n.as_ref() { 1110 os.write_bytes(1, v)?; 1111 } 1112 if let Some(v) = self.e { 1113 os.write_int32(2, v)?; 1114 } 1115 os.write_unknown_fields(self.special_fields.unknown_fields())?; 1116 ::std::result::Result::Ok(()) 1117 } 1118 special_fields(&self) -> &::protobuf::SpecialFields1119 fn special_fields(&self) -> &::protobuf::SpecialFields { 1120 &self.special_fields 1121 } 1122 mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields1123 fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { 1124 &mut self.special_fields 1125 } 1126 new() -> SimpleRsaPublicKey1127 fn new() -> SimpleRsaPublicKey { 1128 SimpleRsaPublicKey::new() 1129 } 1130 clear(&mut self)1131 fn clear(&mut self) { 1132 self.n = ::std::option::Option::None; 1133 self.e = ::std::option::Option::None; 1134 self.special_fields.clear(); 1135 } 1136 default_instance() -> &'static SimpleRsaPublicKey1137 fn default_instance() -> &'static SimpleRsaPublicKey { 1138 static instance: SimpleRsaPublicKey = SimpleRsaPublicKey { 1139 n: ::std::option::Option::None, 1140 e: ::std::option::Option::None, 1141 special_fields: ::protobuf::SpecialFields::new(), 1142 }; 1143 &instance 1144 } 1145 } 1146 1147 #[derive(PartialEq,Clone,Default,Debug)] 1148 // @@protoc_insertion_point(message:securemessage.DhPublicKey) 1149 pub struct DhPublicKey { 1150 // message fields 1151 // @@protoc_insertion_point(field:securemessage.DhPublicKey.y) 1152 pub y: ::std::option::Option<::std::vec::Vec<u8>>, 1153 // special fields 1154 // @@protoc_insertion_point(special_field:securemessage.DhPublicKey.special_fields) 1155 pub special_fields: ::protobuf::SpecialFields, 1156 } 1157 1158 impl<'a> ::std::default::Default for &'a DhPublicKey { default() -> &'a DhPublicKey1159 fn default() -> &'a DhPublicKey { 1160 <DhPublicKey as ::protobuf::Message>::default_instance() 1161 } 1162 } 1163 1164 impl DhPublicKey { new() -> DhPublicKey1165 pub fn new() -> DhPublicKey { 1166 ::std::default::Default::default() 1167 } 1168 1169 // required bytes y = 1; 1170 y(&self) -> &[u8]1171 pub fn y(&self) -> &[u8] { 1172 match self.y.as_ref() { 1173 Some(v) => v, 1174 None => &[], 1175 } 1176 } 1177 clear_y(&mut self)1178 pub fn clear_y(&mut self) { 1179 self.y = ::std::option::Option::None; 1180 } 1181 has_y(&self) -> bool1182 pub fn has_y(&self) -> bool { 1183 self.y.is_some() 1184 } 1185 1186 // Param is passed by value, moved set_y(&mut self, v: ::std::vec::Vec<u8>)1187 pub fn set_y(&mut self, v: ::std::vec::Vec<u8>) { 1188 self.y = ::std::option::Option::Some(v); 1189 } 1190 1191 // Mutable pointer to the field. 1192 // If field is not initialized, it is initialized with default value first. mut_y(&mut self) -> &mut ::std::vec::Vec<u8>1193 pub fn mut_y(&mut self) -> &mut ::std::vec::Vec<u8> { 1194 if self.y.is_none() { 1195 self.y = ::std::option::Option::Some(::std::vec::Vec::new()); 1196 } 1197 self.y.as_mut().unwrap() 1198 } 1199 1200 // Take field take_y(&mut self) -> ::std::vec::Vec<u8>1201 pub fn take_y(&mut self) -> ::std::vec::Vec<u8> { 1202 self.y.take().unwrap_or_else(|| ::std::vec::Vec::new()) 1203 } 1204 } 1205 1206 impl ::protobuf::Message for DhPublicKey { 1207 const NAME: &'static str = "DhPublicKey"; 1208 is_initialized(&self) -> bool1209 fn is_initialized(&self) -> bool { 1210 if self.y.is_none() { 1211 return false; 1212 } 1213 true 1214 } 1215 merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()>1216 fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { 1217 while let Some(tag) = is.read_raw_tag_or_eof()? { 1218 match tag { 1219 10 => { 1220 self.y = ::std::option::Option::Some(is.read_bytes()?); 1221 }, 1222 tag => { 1223 ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; 1224 }, 1225 }; 1226 } 1227 ::std::result::Result::Ok(()) 1228 } 1229 1230 // Compute sizes of nested messages 1231 #[allow(unused_variables)] compute_size(&self) -> u641232 fn compute_size(&self) -> u64 { 1233 let mut my_size = 0; 1234 if let Some(v) = self.y.as_ref() { 1235 my_size += ::protobuf::rt::bytes_size(1, &v); 1236 } 1237 my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); 1238 self.special_fields.cached_size().set(my_size as u32); 1239 my_size 1240 } 1241 write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()>1242 fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { 1243 if let Some(v) = self.y.as_ref() { 1244 os.write_bytes(1, v)?; 1245 } 1246 os.write_unknown_fields(self.special_fields.unknown_fields())?; 1247 ::std::result::Result::Ok(()) 1248 } 1249 special_fields(&self) -> &::protobuf::SpecialFields1250 fn special_fields(&self) -> &::protobuf::SpecialFields { 1251 &self.special_fields 1252 } 1253 mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields1254 fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { 1255 &mut self.special_fields 1256 } 1257 new() -> DhPublicKey1258 fn new() -> DhPublicKey { 1259 DhPublicKey::new() 1260 } 1261 clear(&mut self)1262 fn clear(&mut self) { 1263 self.y = ::std::option::Option::None; 1264 self.special_fields.clear(); 1265 } 1266 default_instance() -> &'static DhPublicKey1267 fn default_instance() -> &'static DhPublicKey { 1268 static instance: DhPublicKey = DhPublicKey { 1269 y: ::std::option::Option::None, 1270 special_fields: ::protobuf::SpecialFields::new(), 1271 }; 1272 &instance 1273 } 1274 } 1275 1276 #[derive(PartialEq,Clone,Default,Debug)] 1277 // @@protoc_insertion_point(message:securemessage.GenericPublicKey) 1278 pub struct GenericPublicKey { 1279 // message fields 1280 // @@protoc_insertion_point(field:securemessage.GenericPublicKey.type) 1281 pub type_: ::std::option::Option<::protobuf::EnumOrUnknown<PublicKeyType>>, 1282 // @@protoc_insertion_point(field:securemessage.GenericPublicKey.ec_p256_public_key) 1283 pub ec_p256_public_key: ::protobuf::MessageField<EcP256PublicKey>, 1284 // @@protoc_insertion_point(field:securemessage.GenericPublicKey.rsa2048_public_key) 1285 pub rsa2048_public_key: ::protobuf::MessageField<SimpleRsaPublicKey>, 1286 // @@protoc_insertion_point(field:securemessage.GenericPublicKey.dh2048_public_key) 1287 pub dh2048_public_key: ::protobuf::MessageField<DhPublicKey>, 1288 // special fields 1289 // @@protoc_insertion_point(special_field:securemessage.GenericPublicKey.special_fields) 1290 pub special_fields: ::protobuf::SpecialFields, 1291 } 1292 1293 impl<'a> ::std::default::Default for &'a GenericPublicKey { default() -> &'a GenericPublicKey1294 fn default() -> &'a GenericPublicKey { 1295 <GenericPublicKey as ::protobuf::Message>::default_instance() 1296 } 1297 } 1298 1299 impl GenericPublicKey { new() -> GenericPublicKey1300 pub fn new() -> GenericPublicKey { 1301 ::std::default::Default::default() 1302 } 1303 1304 // required .securemessage.PublicKeyType type = 1; 1305 type_(&self) -> PublicKeyType1306 pub fn type_(&self) -> PublicKeyType { 1307 match self.type_ { 1308 Some(e) => e.enum_value_or(PublicKeyType::EC_P256), 1309 None => PublicKeyType::EC_P256, 1310 } 1311 } 1312 clear_type_(&mut self)1313 pub fn clear_type_(&mut self) { 1314 self.type_ = ::std::option::Option::None; 1315 } 1316 has_type(&self) -> bool1317 pub fn has_type(&self) -> bool { 1318 self.type_.is_some() 1319 } 1320 1321 // Param is passed by value, moved set_type(&mut self, v: PublicKeyType)1322 pub fn set_type(&mut self, v: PublicKeyType) { 1323 self.type_ = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); 1324 } 1325 } 1326 1327 impl ::protobuf::Message for GenericPublicKey { 1328 const NAME: &'static str = "GenericPublicKey"; 1329 is_initialized(&self) -> bool1330 fn is_initialized(&self) -> bool { 1331 if self.type_.is_none() { 1332 return false; 1333 } 1334 for v in &self.ec_p256_public_key { 1335 if !v.is_initialized() { 1336 return false; 1337 } 1338 }; 1339 for v in &self.rsa2048_public_key { 1340 if !v.is_initialized() { 1341 return false; 1342 } 1343 }; 1344 for v in &self.dh2048_public_key { 1345 if !v.is_initialized() { 1346 return false; 1347 } 1348 }; 1349 true 1350 } 1351 merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()>1352 fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { 1353 while let Some(tag) = is.read_raw_tag_or_eof()? { 1354 match tag { 1355 8 => { 1356 self.type_ = ::std::option::Option::Some(is.read_enum_or_unknown()?); 1357 }, 1358 18 => { 1359 ::protobuf::rt::read_singular_message_into_field(is, &mut self.ec_p256_public_key)?; 1360 }, 1361 26 => { 1362 ::protobuf::rt::read_singular_message_into_field(is, &mut self.rsa2048_public_key)?; 1363 }, 1364 34 => { 1365 ::protobuf::rt::read_singular_message_into_field(is, &mut self.dh2048_public_key)?; 1366 }, 1367 tag => { 1368 ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; 1369 }, 1370 }; 1371 } 1372 ::std::result::Result::Ok(()) 1373 } 1374 1375 // Compute sizes of nested messages 1376 #[allow(unused_variables)] compute_size(&self) -> u641377 fn compute_size(&self) -> u64 { 1378 let mut my_size = 0; 1379 if let Some(v) = self.type_ { 1380 my_size += ::protobuf::rt::int32_size(1, v.value()); 1381 } 1382 if let Some(v) = self.ec_p256_public_key.as_ref() { 1383 let len = v.compute_size(); 1384 my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; 1385 } 1386 if let Some(v) = self.rsa2048_public_key.as_ref() { 1387 let len = v.compute_size(); 1388 my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; 1389 } 1390 if let Some(v) = self.dh2048_public_key.as_ref() { 1391 let len = v.compute_size(); 1392 my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; 1393 } 1394 my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); 1395 self.special_fields.cached_size().set(my_size as u32); 1396 my_size 1397 } 1398 write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()>1399 fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { 1400 if let Some(v) = self.type_ { 1401 os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; 1402 } 1403 if let Some(v) = self.ec_p256_public_key.as_ref() { 1404 ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; 1405 } 1406 if let Some(v) = self.rsa2048_public_key.as_ref() { 1407 ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; 1408 } 1409 if let Some(v) = self.dh2048_public_key.as_ref() { 1410 ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; 1411 } 1412 os.write_unknown_fields(self.special_fields.unknown_fields())?; 1413 ::std::result::Result::Ok(()) 1414 } 1415 special_fields(&self) -> &::protobuf::SpecialFields1416 fn special_fields(&self) -> &::protobuf::SpecialFields { 1417 &self.special_fields 1418 } 1419 mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields1420 fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { 1421 &mut self.special_fields 1422 } 1423 new() -> GenericPublicKey1424 fn new() -> GenericPublicKey { 1425 GenericPublicKey::new() 1426 } 1427 clear(&mut self)1428 fn clear(&mut self) { 1429 self.type_ = ::std::option::Option::None; 1430 self.ec_p256_public_key.clear(); 1431 self.rsa2048_public_key.clear(); 1432 self.dh2048_public_key.clear(); 1433 self.special_fields.clear(); 1434 } 1435 default_instance() -> &'static GenericPublicKey1436 fn default_instance() -> &'static GenericPublicKey { 1437 static instance: GenericPublicKey = GenericPublicKey { 1438 type_: ::std::option::Option::None, 1439 ec_p256_public_key: ::protobuf::MessageField::none(), 1440 rsa2048_public_key: ::protobuf::MessageField::none(), 1441 dh2048_public_key: ::protobuf::MessageField::none(), 1442 special_fields: ::protobuf::SpecialFields::new(), 1443 }; 1444 &instance 1445 } 1446 } 1447 1448 #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] 1449 // @@protoc_insertion_point(enum:securemessage.SigScheme) 1450 pub enum SigScheme { 1451 // @@protoc_insertion_point(enum_value:securemessage.SigScheme.HMAC_SHA256) 1452 HMAC_SHA256 = 1, 1453 // @@protoc_insertion_point(enum_value:securemessage.SigScheme.ECDSA_P256_SHA256) 1454 ECDSA_P256_SHA256 = 2, 1455 // @@protoc_insertion_point(enum_value:securemessage.SigScheme.RSA2048_SHA256) 1456 RSA2048_SHA256 = 3, 1457 // @@protoc_insertion_point(enum_value:securemessage.SigScheme.AEAD) 1458 AEAD = 4, 1459 } 1460 1461 impl ::protobuf::Enum for SigScheme { 1462 const NAME: &'static str = "SigScheme"; 1463 value(&self) -> i321464 fn value(&self) -> i32 { 1465 *self as i32 1466 } 1467 from_i32(value: i32) -> ::std::option::Option<SigScheme>1468 fn from_i32(value: i32) -> ::std::option::Option<SigScheme> { 1469 match value { 1470 1 => ::std::option::Option::Some(SigScheme::HMAC_SHA256), 1471 2 => ::std::option::Option::Some(SigScheme::ECDSA_P256_SHA256), 1472 3 => ::std::option::Option::Some(SigScheme::RSA2048_SHA256), 1473 4 => ::std::option::Option::Some(SigScheme::AEAD), 1474 _ => ::std::option::Option::None 1475 } 1476 } 1477 1478 const VALUES: &'static [SigScheme] = &[ 1479 SigScheme::HMAC_SHA256, 1480 SigScheme::ECDSA_P256_SHA256, 1481 SigScheme::RSA2048_SHA256, 1482 SigScheme::AEAD, 1483 ]; 1484 } 1485 1486 // Note, `Default` is implemented although default value is not 0 1487 impl ::std::default::Default for SigScheme { default() -> Self1488 fn default() -> Self { 1489 SigScheme::HMAC_SHA256 1490 } 1491 } 1492 1493 1494 #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] 1495 // @@protoc_insertion_point(enum:securemessage.EncScheme) 1496 pub enum EncScheme { 1497 // @@protoc_insertion_point(enum_value:securemessage.EncScheme.NONE) 1498 NONE = 1, 1499 // @@protoc_insertion_point(enum_value:securemessage.EncScheme.AES_256_CBC) 1500 AES_256_CBC = 2, 1501 // @@protoc_insertion_point(enum_value:securemessage.EncScheme.AES_256_GCM_SIV) 1502 AES_256_GCM_SIV = 3, 1503 } 1504 1505 impl ::protobuf::Enum for EncScheme { 1506 const NAME: &'static str = "EncScheme"; 1507 value(&self) -> i321508 fn value(&self) -> i32 { 1509 *self as i32 1510 } 1511 from_i32(value: i32) -> ::std::option::Option<EncScheme>1512 fn from_i32(value: i32) -> ::std::option::Option<EncScheme> { 1513 match value { 1514 1 => ::std::option::Option::Some(EncScheme::NONE), 1515 2 => ::std::option::Option::Some(EncScheme::AES_256_CBC), 1516 3 => ::std::option::Option::Some(EncScheme::AES_256_GCM_SIV), 1517 _ => ::std::option::Option::None 1518 } 1519 } 1520 1521 const VALUES: &'static [EncScheme] = &[ 1522 EncScheme::NONE, 1523 EncScheme::AES_256_CBC, 1524 EncScheme::AES_256_GCM_SIV, 1525 ]; 1526 } 1527 1528 // Note, `Default` is implemented although default value is not 0 1529 impl ::std::default::Default for EncScheme { default() -> Self1530 fn default() -> Self { 1531 EncScheme::NONE 1532 } 1533 } 1534 1535 1536 #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] 1537 // @@protoc_insertion_point(enum:securemessage.PublicKeyType) 1538 pub enum PublicKeyType { 1539 // @@protoc_insertion_point(enum_value:securemessage.PublicKeyType.EC_P256) 1540 EC_P256 = 1, 1541 // @@protoc_insertion_point(enum_value:securemessage.PublicKeyType.RSA2048) 1542 RSA2048 = 2, 1543 // @@protoc_insertion_point(enum_value:securemessage.PublicKeyType.DH2048_MODP) 1544 DH2048_MODP = 3, 1545 } 1546 1547 impl ::protobuf::Enum for PublicKeyType { 1548 const NAME: &'static str = "PublicKeyType"; 1549 value(&self) -> i321550 fn value(&self) -> i32 { 1551 *self as i32 1552 } 1553 from_i32(value: i32) -> ::std::option::Option<PublicKeyType>1554 fn from_i32(value: i32) -> ::std::option::Option<PublicKeyType> { 1555 match value { 1556 1 => ::std::option::Option::Some(PublicKeyType::EC_P256), 1557 2 => ::std::option::Option::Some(PublicKeyType::RSA2048), 1558 3 => ::std::option::Option::Some(PublicKeyType::DH2048_MODP), 1559 _ => ::std::option::Option::None 1560 } 1561 } 1562 1563 const VALUES: &'static [PublicKeyType] = &[ 1564 PublicKeyType::EC_P256, 1565 PublicKeyType::RSA2048, 1566 PublicKeyType::DH2048_MODP, 1567 ]; 1568 } 1569 1570 // Note, `Default` is implemented although default value is not 0 1571 impl ::std::default::Default for PublicKeyType { default() -> Self1572 fn default() -> Self { 1573 PublicKeyType::EC_P256 1574 } 1575 } 1576 1577