Noise-C
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
certificate.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Southern Storm Software, Pty Ltd.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included
12  * in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20  * DEALINGS IN THE SOFTWARE.
21  */
22 
23 #include "certificate.h"
24 #include <stdlib.h>
25 #include <string.h>
26 
28  uint32_t version;
33 };
34 
37  size_t certs_count_;
38  size_t certs_max_;
39 };
40 
42  char *id;
43  size_t id_size_;
44  char *name;
45  size_t name_size_;
46  char *role;
47  size_t role_size_;
49  size_t keys_count_;
50  size_t keys_max_;
52  size_t meta_count_;
53  size_t meta_max_;
54 };
55 
57  char *algorithm;
59  void *key;
60  size_t key_size_;
61 };
62 
64  char *name;
65  size_t name_size_;
66  char *value;
67  size_t value_size_;
68 };
69 
71  char *id;
72  size_t id_size_;
73  char *name;
74  size_t name_size_;
79  void *signature;
81 };
82 
84  void *nonce;
85  size_t nonce_size_;
86  char *valid_from;
88  char *valid_to;
91  size_t meta_count_;
92  size_t meta_max_;
93 };
94 
96  uint32_t version;
97  char *algorithm;
99  void *salt;
100  size_t salt_size_;
101  uint32_t iterations;
104 };
105 
107  char *id;
108  size_t id_size_;
109  char *name;
110  size_t name_size_;
111  char *role;
112  size_t role_size_;
114  size_t keys_count_;
115  size_t keys_max_;
117  size_t meta_count_;
118  size_t meta_max_;
119 };
120 
122  char *algorithm;
124  void *key;
125  size_t key_size_;
126 };
127 
129 {
130  if (!obj)
132  *obj = (Noise_Certificate *)calloc(1, sizeof(Noise_Certificate));
133  if (!(*obj))
134  return NOISE_ERROR_NO_MEMORY;
135  return NOISE_ERROR_NONE;
136 }
137 
139 {
140  size_t index;
141  if (!obj)
144  for (index = 0; index < obj->signatures_count_; ++index)
145  Noise_Signature_free(obj->signatures[index]);
148  return NOISE_ERROR_NONE;
149 }
150 
152 {
153  size_t end_posn;
154  size_t index;
155  if (!pbuf || !obj)
157  noise_protobuf_write_end_element(pbuf, &end_posn);
158  for (index = obj->signatures_count_; index > 0; --index)
159  Noise_Signature_write(pbuf, 3, obj->signatures[index - 1]);
160  if (obj->subject)
161  Noise_SubjectInfo_write(pbuf, 2, obj->subject);
162  if (obj->version)
163  noise_protobuf_write_uint32(pbuf, 1, obj->version);
164  return noise_protobuf_write_start_element(pbuf, tag, end_posn);
165 }
166 
168 {
169  int err;
170  size_t end_posn;
171  if (!obj)
173  *obj = 0;
174  if (!pbuf)
176  err = Noise_Certificate_new(obj);
177  if (err != NOISE_ERROR_NONE)
178  return err;
179  noise_protobuf_read_start_element(pbuf, tag, &end_posn);
180  while (!noise_protobuf_read_at_end_element(pbuf, end_posn)) {
181  switch (noise_protobuf_peek_tag(pbuf)) {
182  case 1: {
183  noise_protobuf_read_uint32(pbuf, 1, &((*obj)->version));
184  } break;
185  case 2: {
186  Noise_SubjectInfo_free((*obj)->subject);
187  (*obj)->subject = 0;
188  Noise_SubjectInfo_read(pbuf, 2, &((*obj)->subject));
189  } break;
190  case 3: {
191  Noise_Signature *value = 0;
192  int err;
193  Noise_Signature_read(pbuf, 3, &value);
194  err = noise_protobuf_add_to_array((void **)&((*obj)->signatures), &((*obj)->signatures_count_), &((*obj)->signatures_max_), &value, sizeof(value));
195  if (err != NOISE_ERROR_NONE && pbuf->error != NOISE_ERROR_NONE)
196  pbuf->error = err;
197  } break;
198  default: {
200  } break;
201  }
202  }
203  err = noise_protobuf_read_end_element(pbuf, end_posn);
204  if (err != NOISE_ERROR_NONE) {
206  *obj = 0;
207  }
208  return err;
209 }
210 
212 {
213  if (obj) {
214  obj->version = 0;
215  return NOISE_ERROR_NONE;
216  }
218 }
219 
221 {
222  return obj ? (obj->version != 0) : 0;
223 }
224 
226 {
227  return obj ? obj->version : 0;
228 }
229 
231 {
232  if (obj) {
233  obj->version = value;
234  return NOISE_ERROR_NONE;
235  }
237 }
238 
240 {
241  if (obj) {
243  obj->subject = 0;
244  return NOISE_ERROR_NONE;
245  }
247 }
248 
250 {
251  return obj ? (obj->subject != 0) : 0;
252 }
253 
255 {
256  return obj ? obj->subject : 0;
257 }
258 
260 {
261  int err;
262  if (!value)
264  *value = 0;
265  if (!obj)
267  err = Noise_SubjectInfo_new(value);
268  if (err != NOISE_ERROR_NONE)
269  return err;
271  obj->subject = *value;
272  return NOISE_ERROR_NONE;
273 }
274 
276 {
277  size_t index;
278  if (obj) {
279  for (index = 0; index < obj->signatures_count_; ++index)
280  Noise_Signature_free(obj->signatures[index]);
282  obj->signatures = 0;
283  obj->signatures_count_ = 0;
284  obj->signatures_max_ = 0;
285  return NOISE_ERROR_NONE;
286  }
288 }
289 
291 {
292  return obj ? (obj->signatures_count_ != 0) : 0;
293 }
294 
296 {
297  return obj ? obj->signatures_count_ : 0;
298 }
299 
301 {
302  if (obj && index < obj->signatures_count_)
303  return obj->signatures[index];
304  else
305  return 0;
306 }
307 
309 {
310  int err;
311  if (!value)
313  *value = 0;
314  if (!obj)
316  err = Noise_Signature_new(value);
317  if (err != NOISE_ERROR_NONE)
318  return err;
319  err = noise_protobuf_add_to_array((void **)&(obj->signatures), &(obj->signatures_count_), &(obj->signatures_max_), value, sizeof(*value));
320  if (err != NOISE_ERROR_NONE) {
321  Noise_Signature_free(*value);
322  *value = 0;
323  return err;
324  }
325  return NOISE_ERROR_NONE;
326 }
327 
329 {
330  if (!obj || !value)
332  return noise_protobuf_insert_into_array((void **)&(obj->signatures), &(obj->signatures_count_), &(obj->signatures_max_), index, &value, sizeof(value));
333 }
334 
336 {
337  if (!obj)
339  *obj = (Noise_CertificateChain *)calloc(1, sizeof(Noise_CertificateChain));
340  if (!(*obj))
341  return NOISE_ERROR_NO_MEMORY;
342  return NOISE_ERROR_NONE;
343 }
344 
346 {
347  size_t index;
348  if (!obj)
350  for (index = 0; index < obj->certs_count_; ++index)
351  Noise_Certificate_free(obj->certs[index]);
354  return NOISE_ERROR_NONE;
355 }
356 
358 {
359  size_t end_posn;
360  size_t index;
361  if (!pbuf || !obj)
363  noise_protobuf_write_end_element(pbuf, &end_posn);
364  for (index = obj->certs_count_; index > 0; --index)
365  Noise_Certificate_write(pbuf, 8, obj->certs[index - 1]);
366  return noise_protobuf_write_start_element(pbuf, tag, end_posn);
367 }
368 
370 {
371  int err;
372  size_t end_posn;
373  if (!obj)
375  *obj = 0;
376  if (!pbuf)
378  err = Noise_CertificateChain_new(obj);
379  if (err != NOISE_ERROR_NONE)
380  return err;
381  noise_protobuf_read_start_element(pbuf, tag, &end_posn);
382  while (!noise_protobuf_read_at_end_element(pbuf, end_posn)) {
383  switch (noise_protobuf_peek_tag(pbuf)) {
384  case 8: {
385  Noise_Certificate *value = 0;
386  int err;
387  Noise_Certificate_read(pbuf, 8, &value);
388  err = noise_protobuf_add_to_array((void **)&((*obj)->certs), &((*obj)->certs_count_), &((*obj)->certs_max_), &value, sizeof(value));
389  if (err != NOISE_ERROR_NONE && pbuf->error != NOISE_ERROR_NONE)
390  pbuf->error = err;
391  } break;
392  default: {
394  } break;
395  }
396  }
397  err = noise_protobuf_read_end_element(pbuf, end_posn);
398  if (err != NOISE_ERROR_NONE) {
400  *obj = 0;
401  }
402  return err;
403 }
404 
406 {
407  size_t index;
408  if (obj) {
409  for (index = 0; index < obj->certs_count_; ++index)
410  Noise_Certificate_free(obj->certs[index]);
412  obj->certs = 0;
413  obj->certs_count_ = 0;
414  obj->certs_max_ = 0;
415  return NOISE_ERROR_NONE;
416  }
418 }
419 
421 {
422  return obj ? (obj->certs_count_ != 0) : 0;
423 }
424 
426 {
427  return obj ? obj->certs_count_ : 0;
428 }
429 
431 {
432  if (obj && index < obj->certs_count_)
433  return obj->certs[index];
434  else
435  return 0;
436 }
437 
439 {
440  int err;
441  if (!value)
443  *value = 0;
444  if (!obj)
446  err = Noise_Certificate_new(value);
447  if (err != NOISE_ERROR_NONE)
448  return err;
449  err = noise_protobuf_add_to_array((void **)&(obj->certs), &(obj->certs_count_), &(obj->certs_max_), value, sizeof(*value));
450  if (err != NOISE_ERROR_NONE) {
451  Noise_Certificate_free(*value);
452  *value = 0;
453  return err;
454  }
455  return NOISE_ERROR_NONE;
456 }
457 
459 {
460  if (!obj || !value)
462  return noise_protobuf_insert_into_array((void **)&(obj->certs), &(obj->certs_count_), &(obj->certs_max_), index, &value, sizeof(value));
463 }
464 
466 {
467  if (!obj)
469  *obj = (Noise_SubjectInfo *)calloc(1, sizeof(Noise_SubjectInfo));
470  if (!(*obj))
471  return NOISE_ERROR_NO_MEMORY;
472  return NOISE_ERROR_NONE;
473 }
474 
476 {
477  size_t index;
478  if (!obj)
483  for (index = 0; index < obj->keys_count_; ++index)
484  Noise_PublicKeyInfo_free(obj->keys[index]);
486  for (index = 0; index < obj->meta_count_; ++index)
487  Noise_MetaInfo_free(obj->meta[index]);
490  return NOISE_ERROR_NONE;
491 }
492 
494 {
495  size_t end_posn;
496  size_t index;
497  if (!pbuf || !obj)
499  noise_protobuf_write_end_element(pbuf, &end_posn);
500  for (index = obj->meta_count_; index > 0; --index)
501  Noise_MetaInfo_write(pbuf, 5, obj->meta[index - 1]);
502  for (index = obj->keys_count_; index > 0; --index)
503  Noise_PublicKeyInfo_write(pbuf, 4, obj->keys[index - 1]);
504  if (obj->role)
505  noise_protobuf_write_string(pbuf, 3, obj->role, obj->role_size_);
506  if (obj->name)
507  noise_protobuf_write_string(pbuf, 2, obj->name, obj->name_size_);
508  if (obj->id)
509  noise_protobuf_write_string(pbuf, 1, obj->id, obj->id_size_);
510  return noise_protobuf_write_start_element(pbuf, tag, end_posn);
511 }
512 
514 {
515  int err;
516  size_t end_posn;
517  if (!obj)
519  *obj = 0;
520  if (!pbuf)
522  err = Noise_SubjectInfo_new(obj);
523  if (err != NOISE_ERROR_NONE)
524  return err;
525  noise_protobuf_read_start_element(pbuf, tag, &end_posn);
526  while (!noise_protobuf_read_at_end_element(pbuf, end_posn)) {
527  switch (noise_protobuf_peek_tag(pbuf)) {
528  case 1: {
529  noise_protobuf_free_memory((*obj)->id, (*obj)->id_size_);
530  (*obj)->id = 0;
531  (*obj)->id_size_ = 0;
532  noise_protobuf_read_alloc_string(pbuf, 1, &((*obj)->id), 0, &((*obj)->id_size_));
533  } break;
534  case 2: {
535  noise_protobuf_free_memory((*obj)->name, (*obj)->name_size_);
536  (*obj)->name = 0;
537  (*obj)->name_size_ = 0;
538  noise_protobuf_read_alloc_string(pbuf, 2, &((*obj)->name), 0, &((*obj)->name_size_));
539  } break;
540  case 3: {
541  noise_protobuf_free_memory((*obj)->role, (*obj)->role_size_);
542  (*obj)->role = 0;
543  (*obj)->role_size_ = 0;
544  noise_protobuf_read_alloc_string(pbuf, 3, &((*obj)->role), 0, &((*obj)->role_size_));
545  } break;
546  case 4: {
547  Noise_PublicKeyInfo *value = 0;
548  int err;
549  Noise_PublicKeyInfo_read(pbuf, 4, &value);
550  err = noise_protobuf_add_to_array((void **)&((*obj)->keys), &((*obj)->keys_count_), &((*obj)->keys_max_), &value, sizeof(value));
551  if (err != NOISE_ERROR_NONE && pbuf->error != NOISE_ERROR_NONE)
552  pbuf->error = err;
553  } break;
554  case 5: {
555  Noise_MetaInfo *value = 0;
556  int err;
557  Noise_MetaInfo_read(pbuf, 5, &value);
558  err = noise_protobuf_add_to_array((void **)&((*obj)->meta), &((*obj)->meta_count_), &((*obj)->meta_max_), &value, sizeof(value));
559  if (err != NOISE_ERROR_NONE && pbuf->error != NOISE_ERROR_NONE)
560  pbuf->error = err;
561  } break;
562  default: {
564  } break;
565  }
566  }
567  err = noise_protobuf_read_end_element(pbuf, end_posn);
568  if (err != NOISE_ERROR_NONE) {
570  *obj = 0;
571  }
572  return err;
573 }
574 
576 {
577  if (obj) {
579  obj->id = 0;
580  obj->id_size_ = 0;
581  return NOISE_ERROR_NONE;
582  }
584 }
585 
587 {
588  return obj ? (obj->id != 0) : 0;
589 }
590 
592 {
593  return obj ? obj->id : 0;
594 }
595 
597 {
598  return obj ? obj->id_size_ : 0;
599 }
600 
601 int Noise_SubjectInfo_set_id(Noise_SubjectInfo *obj, const char *value, size_t size)
602 {
603  if (obj) {
605  obj->id = (char *)malloc(size + 1);
606  if (obj->id) {
607  memcpy(obj->id, value, size);
608  obj->id[size] = 0;
609  obj->id_size_ = size;
610  return NOISE_ERROR_NONE;
611  } else {
612  obj->id_size_ = 0;
613  return NOISE_ERROR_NO_MEMORY;
614  }
615  }
617 }
618 
620 {
621  if (obj) {
623  obj->name = 0;
624  obj->name_size_ = 0;
625  return NOISE_ERROR_NONE;
626  }
628 }
629 
631 {
632  return obj ? (obj->name != 0) : 0;
633 }
634 
636 {
637  return obj ? obj->name : 0;
638 }
639 
641 {
642  return obj ? obj->name_size_ : 0;
643 }
644 
645 int Noise_SubjectInfo_set_name(Noise_SubjectInfo *obj, const char *value, size_t size)
646 {
647  if (obj) {
649  obj->name = (char *)malloc(size + 1);
650  if (obj->name) {
651  memcpy(obj->name, value, size);
652  obj->name[size] = 0;
653  obj->name_size_ = size;
654  return NOISE_ERROR_NONE;
655  } else {
656  obj->name_size_ = 0;
657  return NOISE_ERROR_NO_MEMORY;
658  }
659  }
661 }
662 
664 {
665  if (obj) {
667  obj->role = 0;
668  obj->role_size_ = 0;
669  return NOISE_ERROR_NONE;
670  }
672 }
673 
675 {
676  return obj ? (obj->role != 0) : 0;
677 }
678 
680 {
681  return obj ? obj->role : 0;
682 }
683 
685 {
686  return obj ? obj->role_size_ : 0;
687 }
688 
689 int Noise_SubjectInfo_set_role(Noise_SubjectInfo *obj, const char *value, size_t size)
690 {
691  if (obj) {
693  obj->role = (char *)malloc(size + 1);
694  if (obj->role) {
695  memcpy(obj->role, value, size);
696  obj->role[size] = 0;
697  obj->role_size_ = size;
698  return NOISE_ERROR_NONE;
699  } else {
700  obj->role_size_ = 0;
701  return NOISE_ERROR_NO_MEMORY;
702  }
703  }
705 }
706 
708 {
709  size_t index;
710  if (obj) {
711  for (index = 0; index < obj->keys_count_; ++index)
712  Noise_PublicKeyInfo_free(obj->keys[index]);
714  obj->keys = 0;
715  obj->keys_count_ = 0;
716  obj->keys_max_ = 0;
717  return NOISE_ERROR_NONE;
718  }
720 }
721 
723 {
724  return obj ? (obj->keys_count_ != 0) : 0;
725 }
726 
728 {
729  return obj ? obj->keys_count_ : 0;
730 }
731 
733 {
734  if (obj && index < obj->keys_count_)
735  return obj->keys[index];
736  else
737  return 0;
738 }
739 
741 {
742  int err;
743  if (!value)
745  *value = 0;
746  if (!obj)
748  err = Noise_PublicKeyInfo_new(value);
749  if (err != NOISE_ERROR_NONE)
750  return err;
751  err = noise_protobuf_add_to_array((void **)&(obj->keys), &(obj->keys_count_), &(obj->keys_max_), value, sizeof(*value));
752  if (err != NOISE_ERROR_NONE) {
753  Noise_PublicKeyInfo_free(*value);
754  *value = 0;
755  return err;
756  }
757  return NOISE_ERROR_NONE;
758 }
759 
761 {
762  if (!obj || !value)
764  return noise_protobuf_insert_into_array((void **)&(obj->keys), &(obj->keys_count_), &(obj->keys_max_), index, &value, sizeof(value));
765 }
766 
768 {
769  size_t index;
770  if (obj) {
771  for (index = 0; index < obj->meta_count_; ++index)
772  Noise_MetaInfo_free(obj->meta[index]);
774  obj->meta = 0;
775  obj->meta_count_ = 0;
776  obj->meta_max_ = 0;
777  return NOISE_ERROR_NONE;
778  }
780 }
781 
783 {
784  return obj ? (obj->meta_count_ != 0) : 0;
785 }
786 
788 {
789  return obj ? obj->meta_count_ : 0;
790 }
791 
793 {
794  if (obj && index < obj->meta_count_)
795  return obj->meta[index];
796  else
797  return 0;
798 }
799 
801 {
802  int err;
803  if (!value)
805  *value = 0;
806  if (!obj)
808  err = Noise_MetaInfo_new(value);
809  if (err != NOISE_ERROR_NONE)
810  return err;
811  err = noise_protobuf_add_to_array((void **)&(obj->meta), &(obj->meta_count_), &(obj->meta_max_), value, sizeof(*value));
812  if (err != NOISE_ERROR_NONE) {
813  Noise_MetaInfo_free(*value);
814  *value = 0;
815  return err;
816  }
817  return NOISE_ERROR_NONE;
818 }
819 
821 {
822  if (!obj || !value)
824  return noise_protobuf_insert_into_array((void **)&(obj->meta), &(obj->meta_count_), &(obj->meta_max_), index, &value, sizeof(value));
825 }
826 
828 {
829  if (!obj)
831  *obj = (Noise_PublicKeyInfo *)calloc(1, sizeof(Noise_PublicKeyInfo));
832  if (!(*obj))
833  return NOISE_ERROR_NO_MEMORY;
834  return NOISE_ERROR_NONE;
835 }
836 
838 {
839  if (!obj)
844  return NOISE_ERROR_NONE;
845 }
846 
848 {
849  size_t end_posn;
850  if (!pbuf || !obj)
852  noise_protobuf_write_end_element(pbuf, &end_posn);
853  if (obj->key)
854  noise_protobuf_write_bytes(pbuf, 2, obj->key, obj->key_size_);
855  if (obj->algorithm)
857  return noise_protobuf_write_start_element(pbuf, tag, end_posn);
858 }
859 
861 {
862  int err;
863  size_t end_posn;
864  if (!obj)
866  *obj = 0;
867  if (!pbuf)
869  err = Noise_PublicKeyInfo_new(obj);
870  if (err != NOISE_ERROR_NONE)
871  return err;
872  noise_protobuf_read_start_element(pbuf, tag, &end_posn);
873  while (!noise_protobuf_read_at_end_element(pbuf, end_posn)) {
874  switch (noise_protobuf_peek_tag(pbuf)) {
875  case 1: {
876  noise_protobuf_free_memory((*obj)->algorithm, (*obj)->algorithm_size_);
877  (*obj)->algorithm = 0;
878  (*obj)->algorithm_size_ = 0;
879  noise_protobuf_read_alloc_string(pbuf, 1, &((*obj)->algorithm), 0, &((*obj)->algorithm_size_));
880  } break;
881  case 2: {
882  noise_protobuf_free_memory((*obj)->key, (*obj)->key_size_);
883  (*obj)->key = 0;
884  (*obj)->key_size_ = 0;
885  noise_protobuf_read_alloc_bytes(pbuf, 2, &((*obj)->key), 0, &((*obj)->key_size_));
886  } break;
887  default: {
889  } break;
890  }
891  }
892  err = noise_protobuf_read_end_element(pbuf, end_posn);
893  if (err != NOISE_ERROR_NONE) {
895  *obj = 0;
896  }
897  return err;
898 }
899 
901 {
902  if (obj) {
904  obj->algorithm = 0;
905  obj->algorithm_size_ = 0;
906  return NOISE_ERROR_NONE;
907  }
909 }
910 
912 {
913  return obj ? (obj->algorithm != 0) : 0;
914 }
915 
917 {
918  return obj ? obj->algorithm : 0;
919 }
920 
922 {
923  return obj ? obj->algorithm_size_ : 0;
924 }
925 
926 int Noise_PublicKeyInfo_set_algorithm(Noise_PublicKeyInfo *obj, const char *value, size_t size)
927 {
928  if (obj) {
930  obj->algorithm = (char *)malloc(size + 1);
931  if (obj->algorithm) {
932  memcpy(obj->algorithm, value, size);
933  obj->algorithm[size] = 0;
934  obj->algorithm_size_ = size;
935  return NOISE_ERROR_NONE;
936  } else {
937  obj->algorithm_size_ = 0;
938  return NOISE_ERROR_NO_MEMORY;
939  }
940  }
942 }
943 
945 {
946  if (obj) {
948  obj->key = 0;
949  obj->key_size_ = 0;
950  return NOISE_ERROR_NONE;
951  }
953 }
954 
956 {
957  return obj ? (obj->key != 0) : 0;
958 }
959 
961 {
962  return obj ? obj->key : 0;
963 }
964 
966 {
967  return obj ? obj->key_size_ : 0;
968 }
969 
970 int Noise_PublicKeyInfo_set_key(Noise_PublicKeyInfo *obj, const void *value, size_t size)
971 {
972  if (obj) {
974  obj->key = (void *)malloc(size ? size : 1);
975  if (obj->key) {
976  memcpy(obj->key, value, size);
977  obj->key_size_ = size;
978  return NOISE_ERROR_NONE;
979  } else {
980  obj->key_size_ = 0;
981  return NOISE_ERROR_NO_MEMORY;
982  }
983  }
985 }
986 
988 {
989  if (!obj)
991  *obj = (Noise_MetaInfo *)calloc(1, sizeof(Noise_MetaInfo));
992  if (!(*obj))
993  return NOISE_ERROR_NO_MEMORY;
994  return NOISE_ERROR_NONE;
995 }
996 
998 {
999  if (!obj)
1004  return NOISE_ERROR_NONE;
1005 }
1006 
1007 int Noise_MetaInfo_write(NoiseProtobuf *pbuf, int tag, const Noise_MetaInfo *obj)
1008 {
1009  size_t end_posn;
1010  if (!pbuf || !obj)
1012  noise_protobuf_write_end_element(pbuf, &end_posn);
1013  if (obj->value)
1014  noise_protobuf_write_string(pbuf, 2, obj->value, obj->value_size_);
1015  if (obj->name)
1016  noise_protobuf_write_string(pbuf, 1, obj->name, obj->name_size_);
1017  return noise_protobuf_write_start_element(pbuf, tag, end_posn);
1018 }
1019 
1021 {
1022  int err;
1023  size_t end_posn;
1024  if (!obj)
1026  *obj = 0;
1027  if (!pbuf)
1029  err = Noise_MetaInfo_new(obj);
1030  if (err != NOISE_ERROR_NONE)
1031  return err;
1032  noise_protobuf_read_start_element(pbuf, tag, &end_posn);
1033  while (!noise_protobuf_read_at_end_element(pbuf, end_posn)) {
1034  switch (noise_protobuf_peek_tag(pbuf)) {
1035  case 1: {
1036  noise_protobuf_free_memory((*obj)->name, (*obj)->name_size_);
1037  (*obj)->name = 0;
1038  (*obj)->name_size_ = 0;
1039  noise_protobuf_read_alloc_string(pbuf, 1, &((*obj)->name), 0, &((*obj)->name_size_));
1040  } break;
1041  case 2: {
1042  noise_protobuf_free_memory((*obj)->value, (*obj)->value_size_);
1043  (*obj)->value = 0;
1044  (*obj)->value_size_ = 0;
1045  noise_protobuf_read_alloc_string(pbuf, 2, &((*obj)->value), 0, &((*obj)->value_size_));
1046  } break;
1047  default: {
1049  } break;
1050  }
1051  }
1052  err = noise_protobuf_read_end_element(pbuf, end_posn);
1053  if (err != NOISE_ERROR_NONE) {
1054  Noise_MetaInfo_free(*obj);
1055  *obj = 0;
1056  }
1057  return err;
1058 }
1059 
1061 {
1062  if (obj) {
1064  obj->name = 0;
1065  obj->name_size_ = 0;
1066  return NOISE_ERROR_NONE;
1067  }
1069 }
1070 
1072 {
1073  return obj ? (obj->name != 0) : 0;
1074 }
1075 
1077 {
1078  return obj ? obj->name : 0;
1079 }
1080 
1082 {
1083  return obj ? obj->name_size_ : 0;
1084 }
1085 
1086 int Noise_MetaInfo_set_name(Noise_MetaInfo *obj, const char *value, size_t size)
1087 {
1088  if (obj) {
1090  obj->name = (char *)malloc(size + 1);
1091  if (obj->name) {
1092  memcpy(obj->name, value, size);
1093  obj->name[size] = 0;
1094  obj->name_size_ = size;
1095  return NOISE_ERROR_NONE;
1096  } else {
1097  obj->name_size_ = 0;
1098  return NOISE_ERROR_NO_MEMORY;
1099  }
1100  }
1102 }
1103 
1105 {
1106  if (obj) {
1108  obj->value = 0;
1109  obj->value_size_ = 0;
1110  return NOISE_ERROR_NONE;
1111  }
1113 }
1114 
1116 {
1117  return obj ? (obj->value != 0) : 0;
1118 }
1119 
1121 {
1122  return obj ? obj->value : 0;
1123 }
1124 
1126 {
1127  return obj ? obj->value_size_ : 0;
1128 }
1129 
1130 int Noise_MetaInfo_set_value(Noise_MetaInfo *obj, const char *value, size_t size)
1131 {
1132  if (obj) {
1134  obj->value = (char *)malloc(size + 1);
1135  if (obj->value) {
1136  memcpy(obj->value, value, size);
1137  obj->value[size] = 0;
1138  obj->value_size_ = size;
1139  return NOISE_ERROR_NONE;
1140  } else {
1141  obj->value_size_ = 0;
1142  return NOISE_ERROR_NO_MEMORY;
1143  }
1144  }
1146 }
1147 
1149 {
1150  if (!obj)
1152  *obj = (Noise_Signature *)calloc(1, sizeof(Noise_Signature));
1153  if (!(*obj))
1154  return NOISE_ERROR_NO_MEMORY;
1155  return NOISE_ERROR_NONE;
1156 }
1157 
1159 {
1160  if (!obj)
1169  return NOISE_ERROR_NONE;
1170 }
1171 
1172 int Noise_Signature_write(NoiseProtobuf *pbuf, int tag, const Noise_Signature *obj)
1173 {
1174  size_t end_posn;
1175  if (!pbuf || !obj)
1177  noise_protobuf_write_end_element(pbuf, &end_posn);
1178  if (obj->signature)
1180  if (obj->extra_signed_info)
1182  if (obj->hash_algorithm)
1184  if (obj->signing_key)
1185  Noise_PublicKeyInfo_write(pbuf, 3, obj->signing_key);
1186  if (obj->name)
1187  noise_protobuf_write_string(pbuf, 2, obj->name, obj->name_size_);
1188  if (obj->id)
1189  noise_protobuf_write_string(pbuf, 1, obj->id, obj->id_size_);
1190  return noise_protobuf_write_start_element(pbuf, tag, end_posn);
1191 }
1192 
1194 {
1195  int err;
1196  size_t end_posn;
1197  if (!obj)
1199  *obj = 0;
1200  if (!pbuf)
1202  err = Noise_Signature_new(obj);
1203  if (err != NOISE_ERROR_NONE)
1204  return err;
1205  noise_protobuf_read_start_element(pbuf, tag, &end_posn);
1206  while (!noise_protobuf_read_at_end_element(pbuf, end_posn)) {
1207  switch (noise_protobuf_peek_tag(pbuf)) {
1208  case 1: {
1209  noise_protobuf_free_memory((*obj)->id, (*obj)->id_size_);
1210  (*obj)->id = 0;
1211  (*obj)->id_size_ = 0;
1212  noise_protobuf_read_alloc_string(pbuf, 1, &((*obj)->id), 0, &((*obj)->id_size_));
1213  } break;
1214  case 2: {
1215  noise_protobuf_free_memory((*obj)->name, (*obj)->name_size_);
1216  (*obj)->name = 0;
1217  (*obj)->name_size_ = 0;
1218  noise_protobuf_read_alloc_string(pbuf, 2, &((*obj)->name), 0, &((*obj)->name_size_));
1219  } break;
1220  case 3: {
1221  Noise_PublicKeyInfo_free((*obj)->signing_key);
1222  (*obj)->signing_key = 0;
1223  Noise_PublicKeyInfo_read(pbuf, 3, &((*obj)->signing_key));
1224  } break;
1225  case 4: {
1226  noise_protobuf_free_memory((*obj)->hash_algorithm, (*obj)->hash_algorithm_size_);
1227  (*obj)->hash_algorithm = 0;
1228  (*obj)->hash_algorithm_size_ = 0;
1229  noise_protobuf_read_alloc_string(pbuf, 4, &((*obj)->hash_algorithm), 0, &((*obj)->hash_algorithm_size_));
1230  } break;
1231  case 5: {
1232  Noise_ExtraSignedInfo_free((*obj)->extra_signed_info);
1233  (*obj)->extra_signed_info = 0;
1234  Noise_ExtraSignedInfo_read(pbuf, 5, &((*obj)->extra_signed_info));
1235  } break;
1236  case 15: {
1237  noise_protobuf_free_memory((*obj)->signature, (*obj)->signature_size_);
1238  (*obj)->signature = 0;
1239  (*obj)->signature_size_ = 0;
1240  noise_protobuf_read_alloc_bytes(pbuf, 15, &((*obj)->signature), 0, &((*obj)->signature_size_));
1241  } break;
1242  default: {
1244  } break;
1245  }
1246  }
1247  err = noise_protobuf_read_end_element(pbuf, end_posn);
1248  if (err != NOISE_ERROR_NONE) {
1249  Noise_Signature_free(*obj);
1250  *obj = 0;
1251  }
1252  return err;
1253 }
1254 
1256 {
1257  if (obj) {
1259  obj->id = 0;
1260  obj->id_size_ = 0;
1261  return NOISE_ERROR_NONE;
1262  }
1264 }
1265 
1267 {
1268  return obj ? (obj->id != 0) : 0;
1269 }
1270 
1272 {
1273  return obj ? obj->id : 0;
1274 }
1275 
1277 {
1278  return obj ? obj->id_size_ : 0;
1279 }
1280 
1281 int Noise_Signature_set_id(Noise_Signature *obj, const char *value, size_t size)
1282 {
1283  if (obj) {
1285  obj->id = (char *)malloc(size + 1);
1286  if (obj->id) {
1287  memcpy(obj->id, value, size);
1288  obj->id[size] = 0;
1289  obj->id_size_ = size;
1290  return NOISE_ERROR_NONE;
1291  } else {
1292  obj->id_size_ = 0;
1293  return NOISE_ERROR_NO_MEMORY;
1294  }
1295  }
1297 }
1298 
1300 {
1301  if (obj) {
1303  obj->name = 0;
1304  obj->name_size_ = 0;
1305  return NOISE_ERROR_NONE;
1306  }
1308 }
1309 
1311 {
1312  return obj ? (obj->name != 0) : 0;
1313 }
1314 
1316 {
1317  return obj ? obj->name : 0;
1318 }
1319 
1321 {
1322  return obj ? obj->name_size_ : 0;
1323 }
1324 
1325 int Noise_Signature_set_name(Noise_Signature *obj, const char *value, size_t size)
1326 {
1327  if (obj) {
1329  obj->name = (char *)malloc(size + 1);
1330  if (obj->name) {
1331  memcpy(obj->name, value, size);
1332  obj->name[size] = 0;
1333  obj->name_size_ = size;
1334  return NOISE_ERROR_NONE;
1335  } else {
1336  obj->name_size_ = 0;
1337  return NOISE_ERROR_NO_MEMORY;
1338  }
1339  }
1341 }
1342 
1344 {
1345  if (obj) {
1347  obj->signing_key = 0;
1348  return NOISE_ERROR_NONE;
1349  }
1351 }
1352 
1354 {
1355  return obj ? (obj->signing_key != 0) : 0;
1356 }
1357 
1359 {
1360  return obj ? obj->signing_key : 0;
1361 }
1362 
1364 {
1365  int err;
1366  if (!value)
1368  *value = 0;
1369  if (!obj)
1371  err = Noise_PublicKeyInfo_new(value);
1372  if (err != NOISE_ERROR_NONE)
1373  return err;
1375  obj->signing_key = *value;
1376  return NOISE_ERROR_NONE;
1377 }
1378 
1380 {
1381  if (obj) {
1383  obj->hash_algorithm = 0;
1384  obj->hash_algorithm_size_ = 0;
1385  return NOISE_ERROR_NONE;
1386  }
1388 }
1389 
1391 {
1392  return obj ? (obj->hash_algorithm != 0) : 0;
1393 }
1394 
1396 {
1397  return obj ? obj->hash_algorithm : 0;
1398 }
1399 
1401 {
1402  return obj ? obj->hash_algorithm_size_ : 0;
1403 }
1404 
1405 int Noise_Signature_set_hash_algorithm(Noise_Signature *obj, const char *value, size_t size)
1406 {
1407  if (obj) {
1409  obj->hash_algorithm = (char *)malloc(size + 1);
1410  if (obj->hash_algorithm) {
1411  memcpy(obj->hash_algorithm, value, size);
1412  obj->hash_algorithm[size] = 0;
1413  obj->hash_algorithm_size_ = size;
1414  return NOISE_ERROR_NONE;
1415  } else {
1416  obj->hash_algorithm_size_ = 0;
1417  return NOISE_ERROR_NO_MEMORY;
1418  }
1419  }
1421 }
1422 
1424 {
1425  if (obj) {
1427  obj->extra_signed_info = 0;
1428  return NOISE_ERROR_NONE;
1429  }
1431 }
1432 
1434 {
1435  return obj ? (obj->extra_signed_info != 0) : 0;
1436 }
1437 
1439 {
1440  return obj ? obj->extra_signed_info : 0;
1441 }
1442 
1444 {
1445  int err;
1446  if (!value)
1448  *value = 0;
1449  if (!obj)
1451  err = Noise_ExtraSignedInfo_new(value);
1452  if (err != NOISE_ERROR_NONE)
1453  return err;
1455  obj->extra_signed_info = *value;
1456  return NOISE_ERROR_NONE;
1457 }
1458 
1460 {
1461  if (obj) {
1463  obj->signature = 0;
1464  obj->signature_size_ = 0;
1465  return NOISE_ERROR_NONE;
1466  }
1468 }
1469 
1471 {
1472  return obj ? (obj->signature != 0) : 0;
1473 }
1474 
1476 {
1477  return obj ? obj->signature : 0;
1478 }
1479 
1481 {
1482  return obj ? obj->signature_size_ : 0;
1483 }
1484 
1485 int Noise_Signature_set_signature(Noise_Signature *obj, const void *value, size_t size)
1486 {
1487  if (obj) {
1489  obj->signature = (void *)malloc(size ? size : 1);
1490  if (obj->signature) {
1491  memcpy(obj->signature, value, size);
1492  obj->signature_size_ = size;
1493  return NOISE_ERROR_NONE;
1494  } else {
1495  obj->signature_size_ = 0;
1496  return NOISE_ERROR_NO_MEMORY;
1497  }
1498  }
1500 }
1501 
1503 {
1504  if (!obj)
1506  *obj = (Noise_ExtraSignedInfo *)calloc(1, sizeof(Noise_ExtraSignedInfo));
1507  if (!(*obj))
1508  return NOISE_ERROR_NO_MEMORY;
1509  return NOISE_ERROR_NONE;
1510 }
1511 
1513 {
1514  size_t index;
1515  if (!obj)
1520  for (index = 0; index < obj->meta_count_; ++index)
1521  Noise_MetaInfo_free(obj->meta[index]);
1522  noise_protobuf_free_memory(obj->meta, obj->meta_max_ * sizeof(Noise_MetaInfo *));
1524  return NOISE_ERROR_NONE;
1525 }
1526 
1528 {
1529  size_t end_posn;
1530  size_t index;
1531  if (!pbuf || !obj)
1533  noise_protobuf_write_end_element(pbuf, &end_posn);
1534  for (index = obj->meta_count_; index > 0; --index)
1535  Noise_MetaInfo_write(pbuf, 4, obj->meta[index - 1]);
1536  if (obj->valid_to)
1538  if (obj->valid_from)
1540  if (obj->nonce)
1541  noise_protobuf_write_bytes(pbuf, 1, obj->nonce, obj->nonce_size_);
1542  return noise_protobuf_write_start_element(pbuf, tag, end_posn);
1543 }
1544 
1546 {
1547  int err;
1548  size_t end_posn;
1549  if (!obj)
1551  *obj = 0;
1552  if (!pbuf)
1554  err = Noise_ExtraSignedInfo_new(obj);
1555  if (err != NOISE_ERROR_NONE)
1556  return err;
1557  noise_protobuf_read_start_element(pbuf, tag, &end_posn);
1558  while (!noise_protobuf_read_at_end_element(pbuf, end_posn)) {
1559  switch (noise_protobuf_peek_tag(pbuf)) {
1560  case 1: {
1561  noise_protobuf_free_memory((*obj)->nonce, (*obj)->nonce_size_);
1562  (*obj)->nonce = 0;
1563  (*obj)->nonce_size_ = 0;
1564  noise_protobuf_read_alloc_bytes(pbuf, 1, &((*obj)->nonce), 0, &((*obj)->nonce_size_));
1565  } break;
1566  case 2: {
1567  noise_protobuf_free_memory((*obj)->valid_from, (*obj)->valid_from_size_);
1568  (*obj)->valid_from = 0;
1569  (*obj)->valid_from_size_ = 0;
1570  noise_protobuf_read_alloc_string(pbuf, 2, &((*obj)->valid_from), 0, &((*obj)->valid_from_size_));
1571  } break;
1572  case 3: {
1573  noise_protobuf_free_memory((*obj)->valid_to, (*obj)->valid_to_size_);
1574  (*obj)->valid_to = 0;
1575  (*obj)->valid_to_size_ = 0;
1576  noise_protobuf_read_alloc_string(pbuf, 3, &((*obj)->valid_to), 0, &((*obj)->valid_to_size_));
1577  } break;
1578  case 4: {
1579  Noise_MetaInfo *value = 0;
1580  int err;
1581  Noise_MetaInfo_read(pbuf, 4, &value);
1582  err = noise_protobuf_add_to_array((void **)&((*obj)->meta), &((*obj)->meta_count_), &((*obj)->meta_max_), &value, sizeof(value));
1583  if (err != NOISE_ERROR_NONE && pbuf->error != NOISE_ERROR_NONE)
1584  pbuf->error = err;
1585  } break;
1586  default: {
1588  } break;
1589  }
1590  }
1591  err = noise_protobuf_read_end_element(pbuf, end_posn);
1592  if (err != NOISE_ERROR_NONE) {
1594  *obj = 0;
1595  }
1596  return err;
1597 }
1598 
1600 {
1601  if (obj) {
1603  obj->nonce = 0;
1604  obj->nonce_size_ = 0;
1605  return NOISE_ERROR_NONE;
1606  }
1608 }
1609 
1611 {
1612  return obj ? (obj->nonce != 0) : 0;
1613 }
1614 
1616 {
1617  return obj ? obj->nonce : 0;
1618 }
1619 
1621 {
1622  return obj ? obj->nonce_size_ : 0;
1623 }
1624 
1625 int Noise_ExtraSignedInfo_set_nonce(Noise_ExtraSignedInfo *obj, const void *value, size_t size)
1626 {
1627  if (obj) {
1629  obj->nonce = (void *)malloc(size ? size : 1);
1630  if (obj->nonce) {
1631  memcpy(obj->nonce, value, size);
1632  obj->nonce_size_ = size;
1633  return NOISE_ERROR_NONE;
1634  } else {
1635  obj->nonce_size_ = 0;
1636  return NOISE_ERROR_NO_MEMORY;
1637  }
1638  }
1640 }
1641 
1643 {
1644  if (obj) {
1646  obj->valid_from = 0;
1647  obj->valid_from_size_ = 0;
1648  return NOISE_ERROR_NONE;
1649  }
1651 }
1652 
1654 {
1655  return obj ? (obj->valid_from != 0) : 0;
1656 }
1657 
1659 {
1660  return obj ? obj->valid_from : 0;
1661 }
1662 
1664 {
1665  return obj ? obj->valid_from_size_ : 0;
1666 }
1667 
1668 int Noise_ExtraSignedInfo_set_valid_from(Noise_ExtraSignedInfo *obj, const char *value, size_t size)
1669 {
1670  if (obj) {
1672  obj->valid_from = (char *)malloc(size + 1);
1673  if (obj->valid_from) {
1674  memcpy(obj->valid_from, value, size);
1675  obj->valid_from[size] = 0;
1676  obj->valid_from_size_ = size;
1677  return NOISE_ERROR_NONE;
1678  } else {
1679  obj->valid_from_size_ = 0;
1680  return NOISE_ERROR_NO_MEMORY;
1681  }
1682  }
1684 }
1685 
1687 {
1688  if (obj) {
1690  obj->valid_to = 0;
1691  obj->valid_to_size_ = 0;
1692  return NOISE_ERROR_NONE;
1693  }
1695 }
1696 
1698 {
1699  return obj ? (obj->valid_to != 0) : 0;
1700 }
1701 
1703 {
1704  return obj ? obj->valid_to : 0;
1705 }
1706 
1708 {
1709  return obj ? obj->valid_to_size_ : 0;
1710 }
1711 
1712 int Noise_ExtraSignedInfo_set_valid_to(Noise_ExtraSignedInfo *obj, const char *value, size_t size)
1713 {
1714  if (obj) {
1716  obj->valid_to = (char *)malloc(size + 1);
1717  if (obj->valid_to) {
1718  memcpy(obj->valid_to, value, size);
1719  obj->valid_to[size] = 0;
1720  obj->valid_to_size_ = size;
1721  return NOISE_ERROR_NONE;
1722  } else {
1723  obj->valid_to_size_ = 0;
1724  return NOISE_ERROR_NO_MEMORY;
1725  }
1726  }
1728 }
1729 
1731 {
1732  size_t index;
1733  if (obj) {
1734  for (index = 0; index < obj->meta_count_; ++index)
1735  Noise_MetaInfo_free(obj->meta[index]);
1736  noise_protobuf_free_memory(obj->meta, obj->meta_max_ * sizeof(Noise_MetaInfo *));
1737  obj->meta = 0;
1738  obj->meta_count_ = 0;
1739  obj->meta_max_ = 0;
1740  return NOISE_ERROR_NONE;
1741  }
1743 }
1744 
1746 {
1747  return obj ? (obj->meta_count_ != 0) : 0;
1748 }
1749 
1751 {
1752  return obj ? obj->meta_count_ : 0;
1753 }
1754 
1756 {
1757  if (obj && index < obj->meta_count_)
1758  return obj->meta[index];
1759  else
1760  return 0;
1761 }
1762 
1764 {
1765  int err;
1766  if (!value)
1768  *value = 0;
1769  if (!obj)
1771  err = Noise_MetaInfo_new(value);
1772  if (err != NOISE_ERROR_NONE)
1773  return err;
1774  err = noise_protobuf_add_to_array((void **)&(obj->meta), &(obj->meta_count_), &(obj->meta_max_), value, sizeof(*value));
1775  if (err != NOISE_ERROR_NONE) {
1776  Noise_MetaInfo_free(*value);
1777  *value = 0;
1778  return err;
1779  }
1780  return NOISE_ERROR_NONE;
1781 }
1782 
1784 {
1785  if (!obj || !value)
1787  return noise_protobuf_insert_into_array((void **)&(obj->meta), &(obj->meta_count_), &(obj->meta_max_), index, &value, sizeof(value));
1788 }
1789 
1791 {
1792  if (!obj)
1794  *obj = (Noise_EncryptedPrivateKey *)calloc(1, sizeof(Noise_EncryptedPrivateKey));
1795  if (!(*obj))
1796  return NOISE_ERROR_NO_MEMORY;
1797  return NOISE_ERROR_NONE;
1798 }
1799 
1801 {
1802  if (!obj)
1808  return NOISE_ERROR_NONE;
1809 }
1810 
1812 {
1813  size_t end_posn;
1814  if (!pbuf || !obj)
1816  noise_protobuf_write_end_element(pbuf, &end_posn);
1817  if (obj->encrypted_data)
1819  if (obj->iterations)
1820  noise_protobuf_write_uint32(pbuf, 13, obj->iterations);
1821  if (obj->salt)
1822  noise_protobuf_write_bytes(pbuf, 12, obj->salt, obj->salt_size_);
1823  if (obj->algorithm)
1825  if (obj->version)
1826  noise_protobuf_write_uint32(pbuf, 10, obj->version);
1827  return noise_protobuf_write_start_element(pbuf, tag, end_posn);
1828 }
1829 
1831 {
1832  int err;
1833  size_t end_posn;
1834  if (!obj)
1836  *obj = 0;
1837  if (!pbuf)
1839  err = Noise_EncryptedPrivateKey_new(obj);
1840  if (err != NOISE_ERROR_NONE)
1841  return err;
1842  noise_protobuf_read_start_element(pbuf, tag, &end_posn);
1843  while (!noise_protobuf_read_at_end_element(pbuf, end_posn)) {
1844  switch (noise_protobuf_peek_tag(pbuf)) {
1845  case 10: {
1846  noise_protobuf_read_uint32(pbuf, 10, &((*obj)->version));
1847  } break;
1848  case 11: {
1849  noise_protobuf_free_memory((*obj)->algorithm, (*obj)->algorithm_size_);
1850  (*obj)->algorithm = 0;
1851  (*obj)->algorithm_size_ = 0;
1852  noise_protobuf_read_alloc_string(pbuf, 11, &((*obj)->algorithm), 0, &((*obj)->algorithm_size_));
1853  } break;
1854  case 12: {
1855  noise_protobuf_free_memory((*obj)->salt, (*obj)->salt_size_);
1856  (*obj)->salt = 0;
1857  (*obj)->salt_size_ = 0;
1858  noise_protobuf_read_alloc_bytes(pbuf, 12, &((*obj)->salt), 0, &((*obj)->salt_size_));
1859  } break;
1860  case 13: {
1861  noise_protobuf_read_uint32(pbuf, 13, &((*obj)->iterations));
1862  } break;
1863  case 15: {
1864  noise_protobuf_free_memory((*obj)->encrypted_data, (*obj)->encrypted_data_size_);
1865  (*obj)->encrypted_data = 0;
1866  (*obj)->encrypted_data_size_ = 0;
1867  noise_protobuf_read_alloc_bytes(pbuf, 15, &((*obj)->encrypted_data), 0, &((*obj)->encrypted_data_size_));
1868  } break;
1869  default: {
1871  } break;
1872  }
1873  }
1874  err = noise_protobuf_read_end_element(pbuf, end_posn);
1875  if (err != NOISE_ERROR_NONE) {
1877  *obj = 0;
1878  }
1879  return err;
1880 }
1881 
1883 {
1884  if (obj) {
1885  obj->version = 0;
1886  return NOISE_ERROR_NONE;
1887  }
1889 }
1890 
1892 {
1893  return obj ? (obj->version != 0) : 0;
1894 }
1895 
1897 {
1898  return obj ? obj->version : 0;
1899 }
1900 
1902 {
1903  if (obj) {
1904  obj->version = value;
1905  return NOISE_ERROR_NONE;
1906  }
1908 }
1909 
1911 {
1912  if (obj) {
1914  obj->algorithm = 0;
1915  obj->algorithm_size_ = 0;
1916  return NOISE_ERROR_NONE;
1917  }
1919 }
1920 
1922 {
1923  return obj ? (obj->algorithm != 0) : 0;
1924 }
1925 
1927 {
1928  return obj ? obj->algorithm : 0;
1929 }
1930 
1932 {
1933  return obj ? obj->algorithm_size_ : 0;
1934 }
1935 
1937 {
1938  if (obj) {
1940  obj->algorithm = (char *)malloc(size + 1);
1941  if (obj->algorithm) {
1942  memcpy(obj->algorithm, value, size);
1943  obj->algorithm[size] = 0;
1944  obj->algorithm_size_ = size;
1945  return NOISE_ERROR_NONE;
1946  } else {
1947  obj->algorithm_size_ = 0;
1948  return NOISE_ERROR_NO_MEMORY;
1949  }
1950  }
1952 }
1953 
1955 {
1956  if (obj) {
1958  obj->salt = 0;
1959  obj->salt_size_ = 0;
1960  return NOISE_ERROR_NONE;
1961  }
1963 }
1964 
1966 {
1967  return obj ? (obj->salt != 0) : 0;
1968 }
1969 
1971 {
1972  return obj ? obj->salt : 0;
1973 }
1974 
1976 {
1977  return obj ? obj->salt_size_ : 0;
1978 }
1979 
1980 int Noise_EncryptedPrivateKey_set_salt(Noise_EncryptedPrivateKey *obj, const void *value, size_t size)
1981 {
1982  if (obj) {
1984  obj->salt = (void *)malloc(size ? size : 1);
1985  if (obj->salt) {
1986  memcpy(obj->salt, value, size);
1987  obj->salt_size_ = size;
1988  return NOISE_ERROR_NONE;
1989  } else {
1990  obj->salt_size_ = 0;
1991  return NOISE_ERROR_NO_MEMORY;
1992  }
1993  }
1995 }
1996 
1998 {
1999  if (obj) {
2000  obj->iterations = 0;
2001  return NOISE_ERROR_NONE;
2002  }
2004 }
2005 
2007 {
2008  return obj ? (obj->iterations != 0) : 0;
2009 }
2010 
2012 {
2013  return obj ? obj->iterations : 0;
2014 }
2015 
2017 {
2018  if (obj) {
2019  obj->iterations = value;
2020  return NOISE_ERROR_NONE;
2021  }
2023 }
2024 
2026 {
2027  if (obj) {
2029  obj->encrypted_data = 0;
2030  obj->encrypted_data_size_ = 0;
2031  return NOISE_ERROR_NONE;
2032  }
2034 }
2035 
2037 {
2038  return obj ? (obj->encrypted_data != 0) : 0;
2039 }
2040 
2042 {
2043  return obj ? obj->encrypted_data : 0;
2044 }
2045 
2047 {
2048  return obj ? obj->encrypted_data_size_ : 0;
2049 }
2050 
2052 {
2053  if (obj) {
2055  obj->encrypted_data = (void *)malloc(size ? size : 1);
2056  if (obj->encrypted_data) {
2057  memcpy(obj->encrypted_data, value, size);
2058  obj->encrypted_data_size_ = size;
2059  return NOISE_ERROR_NONE;
2060  } else {
2061  obj->encrypted_data_size_ = 0;
2062  return NOISE_ERROR_NO_MEMORY;
2063  }
2064  }
2066 }
2067 
2069 {
2070  if (!obj)
2072  *obj = (Noise_PrivateKey *)calloc(1, sizeof(Noise_PrivateKey));
2073  if (!(*obj))
2074  return NOISE_ERROR_NO_MEMORY;
2075  return NOISE_ERROR_NONE;
2076 }
2077 
2079 {
2080  size_t index;
2081  if (!obj)
2086  for (index = 0; index < obj->keys_count_; ++index)
2087  Noise_PrivateKeyInfo_free(obj->keys[index]);
2089  for (index = 0; index < obj->meta_count_; ++index)
2090  Noise_MetaInfo_free(obj->meta[index]);
2091  noise_protobuf_free_memory(obj->meta, obj->meta_max_ * sizeof(Noise_MetaInfo *));
2093  return NOISE_ERROR_NONE;
2094 }
2095 
2097 {
2098  size_t end_posn;
2099  size_t index;
2100  if (!pbuf || !obj)
2102  noise_protobuf_write_end_element(pbuf, &end_posn);
2103  for (index = obj->meta_count_; index > 0; --index)
2104  Noise_MetaInfo_write(pbuf, 5, obj->meta[index - 1]);
2105  for (index = obj->keys_count_; index > 0; --index)
2106  Noise_PrivateKeyInfo_write(pbuf, 4, obj->keys[index - 1]);
2107  if (obj->role)
2108  noise_protobuf_write_string(pbuf, 3, obj->role, obj->role_size_);
2109  if (obj->name)
2110  noise_protobuf_write_string(pbuf, 2, obj->name, obj->name_size_);
2111  if (obj->id)
2112  noise_protobuf_write_string(pbuf, 1, obj->id, obj->id_size_);
2113  return noise_protobuf_write_start_element(pbuf, tag, end_posn);
2114 }
2115 
2117 {
2118  int err;
2119  size_t end_posn;
2120  if (!obj)
2122  *obj = 0;
2123  if (!pbuf)
2125  err = Noise_PrivateKey_new(obj);
2126  if (err != NOISE_ERROR_NONE)
2127  return err;
2128  noise_protobuf_read_start_element(pbuf, tag, &end_posn);
2129  while (!noise_protobuf_read_at_end_element(pbuf, end_posn)) {
2130  switch (noise_protobuf_peek_tag(pbuf)) {
2131  case 1: {
2132  noise_protobuf_free_memory((*obj)->id, (*obj)->id_size_);
2133  (*obj)->id = 0;
2134  (*obj)->id_size_ = 0;
2135  noise_protobuf_read_alloc_string(pbuf, 1, &((*obj)->id), 0, &((*obj)->id_size_));
2136  } break;
2137  case 2: {
2138  noise_protobuf_free_memory((*obj)->name, (*obj)->name_size_);
2139  (*obj)->name = 0;
2140  (*obj)->name_size_ = 0;
2141  noise_protobuf_read_alloc_string(pbuf, 2, &((*obj)->name), 0, &((*obj)->name_size_));
2142  } break;
2143  case 3: {
2144  noise_protobuf_free_memory((*obj)->role, (*obj)->role_size_);
2145  (*obj)->role = 0;
2146  (*obj)->role_size_ = 0;
2147  noise_protobuf_read_alloc_string(pbuf, 3, &((*obj)->role), 0, &((*obj)->role_size_));
2148  } break;
2149  case 4: {
2150  Noise_PrivateKeyInfo *value = 0;
2151  int err;
2152  Noise_PrivateKeyInfo_read(pbuf, 4, &value);
2153  err = noise_protobuf_add_to_array((void **)&((*obj)->keys), &((*obj)->keys_count_), &((*obj)->keys_max_), &value, sizeof(value));
2154  if (err != NOISE_ERROR_NONE && pbuf->error != NOISE_ERROR_NONE)
2155  pbuf->error = err;
2156  } break;
2157  case 5: {
2158  Noise_MetaInfo *value = 0;
2159  int err;
2160  Noise_MetaInfo_read(pbuf, 5, &value);
2161  err = noise_protobuf_add_to_array((void **)&((*obj)->meta), &((*obj)->meta_count_), &((*obj)->meta_max_), &value, sizeof(value));
2162  if (err != NOISE_ERROR_NONE && pbuf->error != NOISE_ERROR_NONE)
2163  pbuf->error = err;
2164  } break;
2165  default: {
2167  } break;
2168  }
2169  }
2170  err = noise_protobuf_read_end_element(pbuf, end_posn);
2171  if (err != NOISE_ERROR_NONE) {
2172  Noise_PrivateKey_free(*obj);
2173  *obj = 0;
2174  }
2175  return err;
2176 }
2177 
2179 {
2180  if (obj) {
2182  obj->id = 0;
2183  obj->id_size_ = 0;
2184  return NOISE_ERROR_NONE;
2185  }
2187 }
2188 
2190 {
2191  return obj ? (obj->id != 0) : 0;
2192 }
2193 
2195 {
2196  return obj ? obj->id : 0;
2197 }
2198 
2200 {
2201  return obj ? obj->id_size_ : 0;
2202 }
2203 
2204 int Noise_PrivateKey_set_id(Noise_PrivateKey *obj, const char *value, size_t size)
2205 {
2206  if (obj) {
2208  obj->id = (char *)malloc(size + 1);
2209  if (obj->id) {
2210  memcpy(obj->id, value, size);
2211  obj->id[size] = 0;
2212  obj->id_size_ = size;
2213  return NOISE_ERROR_NONE;
2214  } else {
2215  obj->id_size_ = 0;
2216  return NOISE_ERROR_NO_MEMORY;
2217  }
2218  }
2220 }
2221 
2223 {
2224  if (obj) {
2226  obj->name = 0;
2227  obj->name_size_ = 0;
2228  return NOISE_ERROR_NONE;
2229  }
2231 }
2232 
2234 {
2235  return obj ? (obj->name != 0) : 0;
2236 }
2237 
2239 {
2240  return obj ? obj->name : 0;
2241 }
2242 
2244 {
2245  return obj ? obj->name_size_ : 0;
2246 }
2247 
2248 int Noise_PrivateKey_set_name(Noise_PrivateKey *obj, const char *value, size_t size)
2249 {
2250  if (obj) {
2252  obj->name = (char *)malloc(size + 1);
2253  if (obj->name) {
2254  memcpy(obj->name, value, size);
2255  obj->name[size] = 0;
2256  obj->name_size_ = size;
2257  return NOISE_ERROR_NONE;
2258  } else {
2259  obj->name_size_ = 0;
2260  return NOISE_ERROR_NO_MEMORY;
2261  }
2262  }
2264 }
2265 
2267 {
2268  if (obj) {
2270  obj->role = 0;
2271  obj->role_size_ = 0;
2272  return NOISE_ERROR_NONE;
2273  }
2275 }
2276 
2278 {
2279  return obj ? (obj->role != 0) : 0;
2280 }
2281 
2283 {
2284  return obj ? obj->role : 0;
2285 }
2286 
2288 {
2289  return obj ? obj->role_size_ : 0;
2290 }
2291 
2292 int Noise_PrivateKey_set_role(Noise_PrivateKey *obj, const char *value, size_t size)
2293 {
2294  if (obj) {
2296  obj->role = (char *)malloc(size + 1);
2297  if (obj->role) {
2298  memcpy(obj->role, value, size);
2299  obj->role[size] = 0;
2300  obj->role_size_ = size;
2301  return NOISE_ERROR_NONE;
2302  } else {
2303  obj->role_size_ = 0;
2304  return NOISE_ERROR_NO_MEMORY;
2305  }
2306  }
2308 }
2309 
2311 {
2312  size_t index;
2313  if (obj) {
2314  for (index = 0; index < obj->keys_count_; ++index)
2315  Noise_PrivateKeyInfo_free(obj->keys[index]);
2317  obj->keys = 0;
2318  obj->keys_count_ = 0;
2319  obj->keys_max_ = 0;
2320  return NOISE_ERROR_NONE;
2321  }
2323 }
2324 
2326 {
2327  return obj ? (obj->keys_count_ != 0) : 0;
2328 }
2329 
2331 {
2332  return obj ? obj->keys_count_ : 0;
2333 }
2334 
2336 {
2337  if (obj && index < obj->keys_count_)
2338  return obj->keys[index];
2339  else
2340  return 0;
2341 }
2342 
2344 {
2345  int err;
2346  if (!value)
2348  *value = 0;
2349  if (!obj)
2351  err = Noise_PrivateKeyInfo_new(value);
2352  if (err != NOISE_ERROR_NONE)
2353  return err;
2354  err = noise_protobuf_add_to_array((void **)&(obj->keys), &(obj->keys_count_), &(obj->keys_max_), value, sizeof(*value));
2355  if (err != NOISE_ERROR_NONE) {
2356  Noise_PrivateKeyInfo_free(*value);
2357  *value = 0;
2358  return err;
2359  }
2360  return NOISE_ERROR_NONE;
2361 }
2362 
2364 {
2365  if (!obj || !value)
2367  return noise_protobuf_insert_into_array((void **)&(obj->keys), &(obj->keys_count_), &(obj->keys_max_), index, &value, sizeof(value));
2368 }
2369 
2371 {
2372  size_t index;
2373  if (obj) {
2374  for (index = 0; index < obj->meta_count_; ++index)
2375  Noise_MetaInfo_free(obj->meta[index]);
2376  noise_protobuf_free_memory(obj->meta, obj->meta_max_ * sizeof(Noise_MetaInfo *));
2377  obj->meta = 0;
2378  obj->meta_count_ = 0;
2379  obj->meta_max_ = 0;
2380  return NOISE_ERROR_NONE;
2381  }
2383 }
2384 
2386 {
2387  return obj ? (obj->meta_count_ != 0) : 0;
2388 }
2389 
2391 {
2392  return obj ? obj->meta_count_ : 0;
2393 }
2394 
2396 {
2397  if (obj && index < obj->meta_count_)
2398  return obj->meta[index];
2399  else
2400  return 0;
2401 }
2402 
2404 {
2405  int err;
2406  if (!value)
2408  *value = 0;
2409  if (!obj)
2411  err = Noise_MetaInfo_new(value);
2412  if (err != NOISE_ERROR_NONE)
2413  return err;
2414  err = noise_protobuf_add_to_array((void **)&(obj->meta), &(obj->meta_count_), &(obj->meta_max_), value, sizeof(*value));
2415  if (err != NOISE_ERROR_NONE) {
2416  Noise_MetaInfo_free(*value);
2417  *value = 0;
2418  return err;
2419  }
2420  return NOISE_ERROR_NONE;
2421 }
2422 
2424 {
2425  if (!obj || !value)
2427  return noise_protobuf_insert_into_array((void **)&(obj->meta), &(obj->meta_count_), &(obj->meta_max_), index, &value, sizeof(value));
2428 }
2429 
2431 {
2432  if (!obj)
2434  *obj = (Noise_PrivateKeyInfo *)calloc(1, sizeof(Noise_PrivateKeyInfo));
2435  if (!(*obj))
2436  return NOISE_ERROR_NO_MEMORY;
2437  return NOISE_ERROR_NONE;
2438 }
2439 
2441 {
2442  if (!obj)
2447  return NOISE_ERROR_NONE;
2448 }
2449 
2451 {
2452  size_t end_posn;
2453  if (!pbuf || !obj)
2455  noise_protobuf_write_end_element(pbuf, &end_posn);
2456  if (obj->key)
2457  noise_protobuf_write_bytes(pbuf, 2, obj->key, obj->key_size_);
2458  if (obj->algorithm)
2460  return noise_protobuf_write_start_element(pbuf, tag, end_posn);
2461 }
2462 
2464 {
2465  int err;
2466  size_t end_posn;
2467  if (!obj)
2469  *obj = 0;
2470  if (!pbuf)
2472  err = Noise_PrivateKeyInfo_new(obj);
2473  if (err != NOISE_ERROR_NONE)
2474  return err;
2475  noise_protobuf_read_start_element(pbuf, tag, &end_posn);
2476  while (!noise_protobuf_read_at_end_element(pbuf, end_posn)) {
2477  switch (noise_protobuf_peek_tag(pbuf)) {
2478  case 1: {
2479  noise_protobuf_free_memory((*obj)->algorithm, (*obj)->algorithm_size_);
2480  (*obj)->algorithm = 0;
2481  (*obj)->algorithm_size_ = 0;
2482  noise_protobuf_read_alloc_string(pbuf, 1, &((*obj)->algorithm), 0, &((*obj)->algorithm_size_));
2483  } break;
2484  case 2: {
2485  noise_protobuf_free_memory((*obj)->key, (*obj)->key_size_);
2486  (*obj)->key = 0;
2487  (*obj)->key_size_ = 0;
2488  noise_protobuf_read_alloc_bytes(pbuf, 2, &((*obj)->key), 0, &((*obj)->key_size_));
2489  } break;
2490  default: {
2492  } break;
2493  }
2494  }
2495  err = noise_protobuf_read_end_element(pbuf, end_posn);
2496  if (err != NOISE_ERROR_NONE) {
2498  *obj = 0;
2499  }
2500  return err;
2501 }
2502 
2504 {
2505  if (obj) {
2507  obj->algorithm = 0;
2508  obj->algorithm_size_ = 0;
2509  return NOISE_ERROR_NONE;
2510  }
2512 }
2513 
2515 {
2516  return obj ? (obj->algorithm != 0) : 0;
2517 }
2518 
2520 {
2521  return obj ? obj->algorithm : 0;
2522 }
2523 
2525 {
2526  return obj ? obj->algorithm_size_ : 0;
2527 }
2528 
2529 int Noise_PrivateKeyInfo_set_algorithm(Noise_PrivateKeyInfo *obj, const char *value, size_t size)
2530 {
2531  if (obj) {
2533  obj->algorithm = (char *)malloc(size + 1);
2534  if (obj->algorithm) {
2535  memcpy(obj->algorithm, value, size);
2536  obj->algorithm[size] = 0;
2537  obj->algorithm_size_ = size;
2538  return NOISE_ERROR_NONE;
2539  } else {
2540  obj->algorithm_size_ = 0;
2541  return NOISE_ERROR_NO_MEMORY;
2542  }
2543  }
2545 }
2546 
2548 {
2549  if (obj) {
2551  obj->key = 0;
2552  obj->key_size_ = 0;
2553  return NOISE_ERROR_NONE;
2554  }
2556 }
2557 
2559 {
2560  return obj ? (obj->key != 0) : 0;
2561 }
2562 
2564 {
2565  return obj ? obj->key : 0;
2566 }
2567 
2569 {
2570  return obj ? obj->key_size_ : 0;
2571 }
2572 
2573 int Noise_PrivateKeyInfo_set_key(Noise_PrivateKeyInfo *obj, const void *value, size_t size)
2574 {
2575  if (obj) {
2577  obj->key = (void *)malloc(size ? size : 1);
2578  if (obj->key) {
2579  memcpy(obj->key, value, size);
2580  obj->key_size_ = size;
2581  return NOISE_ERROR_NONE;
2582  } else {
2583  obj->key_size_ = 0;
2584  return NOISE_ERROR_NO_MEMORY;
2585  }
2586  }
2588 }
2589 
const char * Noise_Signature_get_hash_algorithm(const Noise_Signature *obj)
Definition: certificate.c:1395
int Noise_Signature_clear_extra_signed_info(Noise_Signature *obj)
Definition: certificate.c:1423
int Noise_SubjectInfo_add_keys(Noise_SubjectInfo *obj, Noise_PublicKeyInfo **value)
Definition: certificate.c:740
size_t Noise_ExtraSignedInfo_get_size_valid_from(const Noise_ExtraSignedInfo *obj)
Definition: certificate.c:1663
int Noise_Signature_set_name(Noise_Signature *obj, const char *value, size_t size)
Definition: certificate.c:1325
int Noise_Signature_clear_signature(Noise_Signature *obj)
Definition: certificate.c:1459
Noise_MetaInfo * Noise_PrivateKey_get_at_meta(const Noise_PrivateKey *obj, size_t index)
Definition: certificate.c:2395
int Noise_Signature_set_signature(Noise_Signature *obj, const void *value, size_t size)
Definition: certificate.c:1485
const char * Noise_EncryptedPrivateKey_get_algorithm(const Noise_EncryptedPrivateKey *obj)
Definition: certificate.c:1926
const char * Noise_SubjectInfo_get_name(const Noise_SubjectInfo *obj)
Definition: certificate.c:635
int Noise_Certificate_write(NoiseProtobuf *pbuf, int tag, const Noise_Certificate *obj)
Definition: certificate.c:151
int Noise_PrivateKey_clear_id(Noise_PrivateKey *obj)
Definition: certificate.c:2178
int Noise_ExtraSignedInfo_has_valid_from(const Noise_ExtraSignedInfo *obj)
Definition: certificate.c:1653
size_t signatures_count_
Definition: certificate.c:31
int Noise_ExtraSignedInfo_add_meta(Noise_ExtraSignedInfo *obj, Noise_MetaInfo **value)
Definition: certificate.c:1763
int Noise_EncryptedPrivateKey_has_salt(const Noise_EncryptedPrivateKey *obj)
Definition: certificate.c:1965
int Noise_Certificate_free(Noise_Certificate *obj)
Definition: certificate.c:138
int Noise_MetaInfo_clear_value(Noise_MetaInfo *obj)
Definition: certificate.c:1104
int Noise_ExtraSignedInfo_free(Noise_ExtraSignedInfo *obj)
Definition: certificate.c:1512
int Noise_SubjectInfo_set_name(Noise_SubjectInfo *obj, const char *value, size_t size)
Definition: certificate.c:645
Noise_PrivateKeyInfo ** keys
Definition: certificate.c:113
int Noise_Signature_new(Noise_Signature **obj)
Definition: certificate.c:1148
uint32_t Noise_EncryptedPrivateKey_get_iterations(const Noise_EncryptedPrivateKey *obj)
Definition: certificate.c:2011
int Noise_SubjectInfo_new(Noise_SubjectInfo **obj)
Definition: certificate.c:465
size_t Noise_SubjectInfo_get_size_role(const Noise_SubjectInfo *obj)
Definition: certificate.c:684
int noise_protobuf_write_bytes(NoiseProtobuf *pbuf, int tag, const void *data, size_t size)
const void * Noise_EncryptedPrivateKey_get_encrypted_data(const Noise_EncryptedPrivateKey *obj)
Definition: certificate.c:2041
int Noise_EncryptedPrivateKey_write(NoiseProtobuf *pbuf, int tag, const Noise_EncryptedPrivateKey *obj)
Definition: certificate.c:1811
#define NOISE_ERROR_INVALID_PARAM
Invalid parameter to function; e.g. a NULL value.
Noise_Signature * Noise_Certificate_get_at_signatures(const Noise_Certificate *obj, size_t index)
Definition: certificate.c:300
int Noise_PublicKeyInfo_set_algorithm(Noise_PublicKeyInfo *obj, const char *value, size_t size)
Definition: certificate.c:926
uint32_t Noise_Certificate_get_version(const Noise_Certificate *obj)
Definition: certificate.c:225
Noise_SubjectInfo * subject
Definition: certificate.c:29
int Noise_ExtraSignedInfo_write(NoiseProtobuf *pbuf, int tag, const Noise_ExtraSignedInfo *obj)
Definition: certificate.c:1527
int Noise_Signature_has_name(const Noise_Signature *obj)
Definition: certificate.c:1310
int Noise_Signature_clear_hash_algorithm(Noise_Signature *obj)
Definition: certificate.c:1379
int Noise_Certificate_has_signatures(const Noise_Certificate *obj)
Definition: certificate.c:290
int Noise_EncryptedPrivateKey_clear_version(Noise_EncryptedPrivateKey *obj)
Definition: certificate.c:1882
int Noise_SubjectInfo_write(NoiseProtobuf *pbuf, int tag, const Noise_SubjectInfo *obj)
Definition: certificate.c:493
int Noise_SubjectInfo_insert_meta(Noise_SubjectInfo *obj, size_t index, Noise_MetaInfo *value)
Definition: certificate.c:820
int Noise_PrivateKeyInfo_set_algorithm(Noise_PrivateKeyInfo *obj, const char *value, size_t size)
Definition: certificate.c:2529
int noise_protobuf_write_end_element(NoiseProtobuf *pbuf, size_t *end_posn)
int Noise_ExtraSignedInfo_set_valid_to(Noise_ExtraSignedInfo *obj, const char *value, size_t size)
Definition: certificate.c:1712
size_t Noise_Certificate_count_signatures(const Noise_Certificate *obj)
Definition: certificate.c:295
int Noise_MetaInfo_set_value(Noise_MetaInfo *obj, const char *value, size_t size)
Definition: certificate.c:1130
#define NOISE_ERROR_NONE
Success, no error.
size_t value_size_
Definition: certificate.c:67
int noise_protobuf_read_at_end_element(const NoiseProtobuf *pbuf, size_t end_posn)
int Noise_Signature_has_extra_signed_info(const Noise_Signature *obj)
Definition: certificate.c:1433
size_t Noise_PrivateKeyInfo_get_size_algorithm(const Noise_PrivateKeyInfo *obj)
Definition: certificate.c:2524
int Noise_EncryptedPrivateKey_has_algorithm(const Noise_EncryptedPrivateKey *obj)
Definition: certificate.c:1921
const char * Noise_PrivateKey_get_name(const Noise_PrivateKey *obj)
Definition: certificate.c:2238
int Noise_CertificateChain_clear_certs(Noise_CertificateChain *obj)
Definition: certificate.c:405
int noise_protobuf_read_skip(NoiseProtobuf *pbuf)
const char * Noise_PrivateKey_get_id(const Noise_PrivateKey *obj)
Definition: certificate.c:2194
int Noise_PrivateKey_free(Noise_PrivateKey *obj)
Definition: certificate.c:2078
size_t Noise_EncryptedPrivateKey_get_size_algorithm(const Noise_EncryptedPrivateKey *obj)
Definition: certificate.c:1931
int Noise_Signature_write(NoiseProtobuf *pbuf, int tag, const Noise_Signature *obj)
Definition: certificate.c:1172
size_t Noise_Signature_get_size_signature(const Noise_Signature *obj)
Definition: certificate.c:1480
int Noise_MetaInfo_set_name(Noise_MetaInfo *obj, const char *value, size_t size)
Definition: certificate.c:1086
int Noise_PrivateKey_set_role(Noise_PrivateKey *obj, const char *value, size_t size)
Definition: certificate.c:2292
int Noise_CertificateChain_write(NoiseProtobuf *pbuf, int tag, const Noise_CertificateChain *obj)
Definition: certificate.c:357
int Noise_SubjectInfo_add_meta(Noise_SubjectInfo *obj, Noise_MetaInfo **value)
Definition: certificate.c:800
int Noise_PrivateKey_write(NoiseProtobuf *pbuf, int tag, const Noise_PrivateKey *obj)
Definition: certificate.c:2096
const char * Noise_SubjectInfo_get_id(const Noise_SubjectInfo *obj)
Definition: certificate.c:591
int Noise_Signature_clear_name(Noise_Signature *obj)
Definition: certificate.c:1299
const char * Noise_PrivateKey_get_role(const Noise_PrivateKey *obj)
Definition: certificate.c:2282
int Noise_SubjectInfo_clear_keys(Noise_SubjectInfo *obj)
Definition: certificate.c:707
int noise_protobuf_add_to_array(void **array, size_t *count, size_t *max, const void *value, size_t size)
size_t name_size_
Definition: certificate.c:65
int Noise_ExtraSignedInfo_clear_valid_to(Noise_ExtraSignedInfo *obj)
Definition: certificate.c:1686
int Noise_SubjectInfo_has_id(const Noise_SubjectInfo *obj)
Definition: certificate.c:586
size_t Noise_CertificateChain_count_certs(const Noise_CertificateChain *obj)
Definition: certificate.c:425
int Noise_EncryptedPrivateKey_clear_salt(Noise_EncryptedPrivateKey *obj)
Definition: certificate.c:1954
int Noise_Signature_set_id(Noise_Signature *obj, const char *value, size_t size)
Definition: certificate.c:1281
int Noise_Certificate_insert_signatures(Noise_Certificate *obj, size_t index, Noise_Signature *value)
Definition: certificate.c:328
int Noise_EncryptedPrivateKey_new(Noise_EncryptedPrivateKey **obj)
Definition: certificate.c:1790
size_t signature_size_
Definition: certificate.c:80
int Noise_Signature_set_hash_algorithm(Noise_Signature *obj, const char *value, size_t size)
Definition: certificate.c:1405
Noise_MetaInfo * Noise_SubjectInfo_get_at_meta(const Noise_SubjectInfo *obj, size_t index)
Definition: certificate.c:792
const void * Noise_EncryptedPrivateKey_get_salt(const Noise_EncryptedPrivateKey *obj)
Definition: certificate.c:1970
int Noise_PrivateKey_has_id(const Noise_PrivateKey *obj)
Definition: certificate.c:2189
size_t Noise_PrivateKey_count_meta(const Noise_PrivateKey *obj)
Definition: certificate.c:2390
int noise_protobuf_insert_into_array(void **array, size_t *count, size_t *max, size_t index, const void *value, size_t size)
const void * Noise_PrivateKeyInfo_get_key(const Noise_PrivateKeyInfo *obj)
Definition: certificate.c:2563
int Noise_Certificate_get_new_subject(Noise_Certificate *obj, Noise_SubjectInfo **value)
Definition: certificate.c:259
Noise_MetaInfo ** meta
Definition: certificate.c:51
int Noise_Signature_read(NoiseProtobuf *pbuf, int tag, Noise_Signature **obj)
Definition: certificate.c:1193
int Noise_PrivateKey_insert_meta(Noise_PrivateKey *obj, size_t index, Noise_MetaInfo *value)
Definition: certificate.c:2423
Noise_Signature ** signatures
Definition: certificate.c:30
size_t Noise_SubjectInfo_count_keys(const Noise_SubjectInfo *obj)
Definition: certificate.c:727
int Noise_PublicKeyInfo_has_key(const Noise_PublicKeyInfo *obj)
Definition: certificate.c:955
int noise_protobuf_peek_tag(const NoiseProtobuf *pbuf)
int Noise_PublicKeyInfo_write(NoiseProtobuf *pbuf, int tag, const Noise_PublicKeyInfo *obj)
Definition: certificate.c:847
int Noise_EncryptedPrivateKey_has_version(const Noise_EncryptedPrivateKey *obj)
Definition: certificate.c:1891
int Noise_PrivateKey_clear_keys(Noise_PrivateKey *obj)
Definition: certificate.c:2310
Noise_Certificate ** certs
Definition: certificate.c:36
int Noise_PrivateKeyInfo_new(Noise_PrivateKeyInfo **obj)
Definition: certificate.c:2430
size_t Noise_ExtraSignedInfo_get_size_valid_to(const Noise_ExtraSignedInfo *obj)
Definition: certificate.c:1707
int noise_protobuf_write_start_element(NoiseProtobuf *pbuf, int tag, size_t end_posn)
int Noise_Certificate_clear_subject(Noise_Certificate *obj)
Definition: certificate.c:239
int Noise_PrivateKeyInfo_read(NoiseProtobuf *pbuf, int tag, Noise_PrivateKeyInfo **obj)
Definition: certificate.c:2463
int Noise_EncryptedPrivateKey_clear_iterations(Noise_EncryptedPrivateKey *obj)
Definition: certificate.c:1997
int Noise_EncryptedPrivateKey_free(Noise_EncryptedPrivateKey *obj)
Definition: certificate.c:1800
int Noise_SubjectInfo_has_meta(const Noise_SubjectInfo *obj)
Definition: certificate.c:782
int Noise_CertificateChain_add_certs(Noise_CertificateChain *obj, Noise_Certificate **value)
Definition: certificate.c:438
size_t Noise_PublicKeyInfo_get_size_key(const Noise_PublicKeyInfo *obj)
Definition: certificate.c:965
Noise_Certificate * Noise_CertificateChain_get_at_certs(const Noise_CertificateChain *obj, size_t index)
Definition: certificate.c:430
int Noise_Certificate_has_version(const Noise_Certificate *obj)
Definition: certificate.c:220
#define NOISE_ERROR_NO_MEMORY
Insufficient memory to complete the operation.
size_t Noise_PrivateKeyInfo_get_size_key(const Noise_PrivateKeyInfo *obj)
Definition: certificate.c:2568
int Noise_PublicKeyInfo_free(Noise_PublicKeyInfo *obj)
Definition: certificate.c:837
int Noise_Signature_get_new_signing_key(Noise_Signature *obj, Noise_PublicKeyInfo **value)
Definition: certificate.c:1363
Noise_PublicKeyInfo * Noise_Signature_get_signing_key(const Noise_Signature *obj)
Definition: certificate.c:1358
const char * Noise_MetaInfo_get_value(const Noise_MetaInfo *obj)
Definition: certificate.c:1120
Noise_PublicKeyInfo * Noise_SubjectInfo_get_at_keys(const Noise_SubjectInfo *obj, size_t index)
Definition: certificate.c:732
int Noise_Signature_get_new_extra_signed_info(Noise_Signature *obj, Noise_ExtraSignedInfo **value)
Definition: certificate.c:1443
int Noise_MetaInfo_free(Noise_MetaInfo *obj)
Definition: certificate.c:997
int Noise_EncryptedPrivateKey_clear_algorithm(Noise_EncryptedPrivateKey *obj)
Definition: certificate.c:1910
size_t Noise_ExtraSignedInfo_get_size_nonce(const Noise_ExtraSignedInfo *obj)
Definition: certificate.c:1620
const void * Noise_Signature_get_signature(const Noise_Signature *obj)
Definition: certificate.c:1475
int Noise_ExtraSignedInfo_has_meta(const Noise_ExtraSignedInfo *obj)
Definition: certificate.c:1745
size_t Noise_Signature_get_size_name(const Noise_Signature *obj)
Definition: certificate.c:1320
const char * Noise_PrivateKeyInfo_get_algorithm(const Noise_PrivateKeyInfo *obj)
Definition: certificate.c:2519
int Noise_CertificateChain_free(Noise_CertificateChain *obj)
Definition: certificate.c:345
int Noise_PrivateKeyInfo_clear_key(Noise_PrivateKeyInfo *obj)
Definition: certificate.c:2547
Noise_SubjectInfo * Noise_Certificate_get_subject(const Noise_Certificate *obj)
Definition: certificate.c:254
Noise_ExtraSignedInfo * extra_signed_info
Definition: certificate.c:78
int Noise_SubjectInfo_clear_id(Noise_SubjectInfo *obj)
Definition: certificate.c:575
size_t Noise_Signature_get_size_hash_algorithm(const Noise_Signature *obj)
Definition: certificate.c:1400
uint32_t Noise_EncryptedPrivateKey_get_version(const Noise_EncryptedPrivateKey *obj)
Definition: certificate.c:1896
int Noise_ExtraSignedInfo_clear_meta(Noise_ExtraSignedInfo *obj)
Definition: certificate.c:1730
int Noise_PrivateKey_add_keys(Noise_PrivateKey *obj, Noise_PrivateKeyInfo **value)
Definition: certificate.c:2343
int Noise_CertificateChain_insert_certs(Noise_CertificateChain *obj, size_t index, Noise_Certificate *value)
Definition: certificate.c:458
int Noise_PrivateKey_has_meta(const Noise_PrivateKey *obj)
Definition: certificate.c:2385
int Noise_PrivateKeyInfo_clear_algorithm(Noise_PrivateKeyInfo *obj)
Definition: certificate.c:2503
int Noise_Certificate_has_subject(const Noise_Certificate *obj)
Definition: certificate.c:249
int Noise_MetaInfo_write(NoiseProtobuf *pbuf, int tag, const Noise_MetaInfo *obj)
Definition: certificate.c:1007
int Noise_ExtraSignedInfo_has_nonce(const Noise_ExtraSignedInfo *obj)
Definition: certificate.c:1610
int Noise_MetaInfo_read(NoiseProtobuf *pbuf, int tag, Noise_MetaInfo **obj)
Definition: certificate.c:1020
int Noise_PrivateKey_set_id(Noise_PrivateKey *obj, const char *value, size_t size)
Definition: certificate.c:2204
size_t Noise_EncryptedPrivateKey_get_size_salt(const Noise_EncryptedPrivateKey *obj)
Definition: certificate.c:1975
int noise_protobuf_read_alloc_string(NoiseProtobuf *pbuf, int tag, char **str, size_t max_size, size_t *size)
int Noise_Signature_has_signing_key(const Noise_Signature *obj)
Definition: certificate.c:1353
size_t Noise_Signature_get_size_id(const Noise_Signature *obj)
Definition: certificate.c:1276
int Noise_SubjectInfo_insert_keys(Noise_SubjectInfo *obj, size_t index, Noise_PublicKeyInfo *value)
Definition: certificate.c:760
int Noise_PrivateKey_has_name(const Noise_PrivateKey *obj)
Definition: certificate.c:2233
Noise_PrivateKeyInfo * Noise_PrivateKey_get_at_keys(const Noise_PrivateKey *obj, size_t index)
Definition: certificate.c:2335
Noise_MetaInfo ** meta
Definition: certificate.c:90
int Noise_PrivateKeyInfo_has_key(const Noise_PrivateKeyInfo *obj)
Definition: certificate.c:2558
char * hash_algorithm
Definition: certificate.c:76
int Noise_PublicKeyInfo_set_key(Noise_PublicKeyInfo *obj, const void *value, size_t size)
Definition: certificate.c:970
size_t Noise_EncryptedPrivateKey_get_size_encrypted_data(const Noise_EncryptedPrivateKey *obj)
Definition: certificate.c:2046
int Noise_ExtraSignedInfo_read(NoiseProtobuf *pbuf, int tag, Noise_ExtraSignedInfo **obj)
Definition: certificate.c:1545
int Noise_PrivateKey_has_role(const Noise_PrivateKey *obj)
Definition: certificate.c:2277
int Noise_ExtraSignedInfo_insert_meta(Noise_ExtraSignedInfo *obj, size_t index, Noise_MetaInfo *value)
Definition: certificate.c:1783
int Noise_PrivateKey_add_meta(Noise_PrivateKey *obj, Noise_MetaInfo **value)
Definition: certificate.c:2403
int Noise_PrivateKey_set_name(Noise_PrivateKey *obj, const char *value, size_t size)
Definition: certificate.c:2248
int Noise_EncryptedPrivateKey_clear_encrypted_data(Noise_EncryptedPrivateKey *obj)
Definition: certificate.c:2025
int Noise_MetaInfo_has_name(const Noise_MetaInfo *obj)
Definition: certificate.c:1071
int Noise_MetaInfo_has_value(const Noise_MetaInfo *obj)
Definition: certificate.c:1115
int Noise_PublicKeyInfo_clear_algorithm(Noise_PublicKeyInfo *obj)
Definition: certificate.c:900
int Noise_PrivateKey_clear_meta(Noise_PrivateKey *obj)
Definition: certificate.c:2370
Noise_PublicKeyInfo ** keys
Definition: certificate.c:48
void noise_protobuf_free_memory(void *ptr, size_t size)
int Noise_ExtraSignedInfo_set_nonce(Noise_ExtraSignedInfo *obj, const void *value, size_t size)
Definition: certificate.c:1625
int Noise_EncryptedPrivateKey_set_iterations(Noise_EncryptedPrivateKey *obj, uint32_t value)
Definition: certificate.c:2016
const char * Noise_MetaInfo_get_name(const Noise_MetaInfo *obj)
Definition: certificate.c:1076
Noise_MetaInfo * Noise_ExtraSignedInfo_get_at_meta(const Noise_ExtraSignedInfo *obj, size_t index)
Definition: certificate.c:1755
int Noise_EncryptedPrivateKey_has_iterations(const Noise_EncryptedPrivateKey *obj)
Definition: certificate.c:2006
int Noise_PrivateKey_clear_role(Noise_PrivateKey *obj)
Definition: certificate.c:2266
int Noise_Certificate_set_version(Noise_Certificate *obj, uint32_t value)
Definition: certificate.c:230
int Noise_Signature_free(Noise_Signature *obj)
Definition: certificate.c:1158
int Noise_ExtraSignedInfo_set_valid_from(Noise_ExtraSignedInfo *obj, const char *value, size_t size)
Definition: certificate.c:1668
int Noise_Signature_has_hash_algorithm(const Noise_Signature *obj)
Definition: certificate.c:1390
int Noise_PrivateKeyInfo_has_algorithm(const Noise_PrivateKeyInfo *obj)
Definition: certificate.c:2514
int Noise_PublicKeyInfo_clear_key(Noise_PublicKeyInfo *obj)
Definition: certificate.c:944
int noise_protobuf_read_uint32(NoiseProtobuf *pbuf, int tag, uint32_t *value)
size_t Noise_PublicKeyInfo_get_size_algorithm(const Noise_PublicKeyInfo *obj)
Definition: certificate.c:921
size_t Noise_SubjectInfo_get_size_id(const Noise_SubjectInfo *obj)
Definition: certificate.c:596
int Noise_SubjectInfo_clear_meta(Noise_SubjectInfo *obj)
Definition: certificate.c:767
const char * Noise_SubjectInfo_get_role(const Noise_SubjectInfo *obj)
Definition: certificate.c:679
int Noise_PublicKeyInfo_new(Noise_PublicKeyInfo **obj)
Definition: certificate.c:827
int Noise_EncryptedPrivateKey_has_encrypted_data(const Noise_EncryptedPrivateKey *obj)
Definition: certificate.c:2036
size_t Noise_SubjectInfo_get_size_name(const Noise_SubjectInfo *obj)
Definition: certificate.c:640
int Noise_ExtraSignedInfo_clear_valid_from(Noise_ExtraSignedInfo *obj)
Definition: certificate.c:1642
int Noise_SubjectInfo_clear_role(Noise_SubjectInfo *obj)
Definition: certificate.c:663
int Noise_CertificateChain_new(Noise_CertificateChain **obj)
Definition: certificate.c:335
const char * Noise_ExtraSignedInfo_get_valid_from(const Noise_ExtraSignedInfo *obj)
Definition: certificate.c:1658
size_t signatures_max_
Definition: certificate.c:32
int Noise_PrivateKey_has_keys(const Noise_PrivateKey *obj)
Definition: certificate.c:2325
int Noise_Signature_clear_signing_key(Noise_Signature *obj)
Definition: certificate.c:1343
int Noise_SubjectInfo_set_id(Noise_SubjectInfo *obj, const char *value, size_t size)
Definition: certificate.c:601
int Noise_EncryptedPrivateKey_set_algorithm(Noise_EncryptedPrivateKey *obj, const char *value, size_t size)
Definition: certificate.c:1936
int Noise_SubjectInfo_read(NoiseProtobuf *pbuf, int tag, Noise_SubjectInfo **obj)
Definition: certificate.c:513
const void * Noise_PublicKeyInfo_get_key(const Noise_PublicKeyInfo *obj)
Definition: certificate.c:960
Noise_ExtraSignedInfo * Noise_Signature_get_extra_signed_info(const Noise_Signature *obj)
Definition: certificate.c:1438
size_t Noise_MetaInfo_get_size_value(const Noise_MetaInfo *obj)
Definition: certificate.c:1125
int Noise_Certificate_add_signatures(Noise_Certificate *obj, Noise_Signature **value)
Definition: certificate.c:308
int Noise_PrivateKey_clear_name(Noise_PrivateKey *obj)
Definition: certificate.c:2222
int Noise_PublicKeyInfo_has_algorithm(const Noise_PublicKeyInfo *obj)
Definition: certificate.c:911
int Noise_Certificate_clear_signatures(Noise_Certificate *obj)
Definition: certificate.c:275
size_t Noise_PrivateKey_get_size_role(const Noise_PrivateKey *obj)
Definition: certificate.c:2287
int Noise_MetaInfo_clear_name(Noise_MetaInfo *obj)
Definition: certificate.c:1060
int Noise_MetaInfo_new(Noise_MetaInfo **obj)
Definition: certificate.c:987
int noise_protobuf_write_uint32(NoiseProtobuf *pbuf, int tag, uint32_t value)
size_t hash_algorithm_size_
Definition: certificate.c:77
int Noise_PublicKeyInfo_read(NoiseProtobuf *pbuf, int tag, Noise_PublicKeyInfo **obj)
Definition: certificate.c:860
const void * Noise_ExtraSignedInfo_get_nonce(const Noise_ExtraSignedInfo *obj)
Definition: certificate.c:1615
int Noise_SubjectInfo_free(Noise_SubjectInfo *obj)
Definition: certificate.c:475
size_t Noise_PrivateKey_get_size_id(const Noise_PrivateKey *obj)
Definition: certificate.c:2199
int Noise_ExtraSignedInfo_new(Noise_ExtraSignedInfo **obj)
Definition: certificate.c:1502
int Noise_PrivateKeyInfo_free(Noise_PrivateKeyInfo *obj)
Definition: certificate.c:2440
int Noise_Signature_has_id(const Noise_Signature *obj)
Definition: certificate.c:1266
int Noise_EncryptedPrivateKey_set_encrypted_data(Noise_EncryptedPrivateKey *obj, const void *value, size_t size)
Definition: certificate.c:2051
int noise_protobuf_write_string(NoiseProtobuf *pbuf, int tag, const char *str, size_t size)
int Noise_EncryptedPrivateKey_set_salt(Noise_EncryptedPrivateKey *obj, const void *value, size_t size)
Definition: certificate.c:1980
Noise_MetaInfo ** meta
Definition: certificate.c:116
int Noise_CertificateChain_has_certs(const Noise_CertificateChain *obj)
Definition: certificate.c:420
int Noise_SubjectInfo_clear_name(Noise_SubjectInfo *obj)
Definition: certificate.c:619
size_t Noise_PrivateKey_get_size_name(const Noise_PrivateKey *obj)
Definition: certificate.c:2243
int Noise_PrivateKey_read(NoiseProtobuf *pbuf, int tag, Noise_PrivateKey **obj)
Definition: certificate.c:2116
int Noise_Signature_clear_id(Noise_Signature *obj)
Definition: certificate.c:1255
int Noise_SubjectInfo_set_role(Noise_SubjectInfo *obj, const char *value, size_t size)
Definition: certificate.c:689
int Noise_PrivateKeyInfo_write(NoiseProtobuf *pbuf, int tag, const Noise_PrivateKeyInfo *obj)
Definition: certificate.c:2450
const char * Noise_ExtraSignedInfo_get_valid_to(const Noise_ExtraSignedInfo *obj)
Definition: certificate.c:1702
int Noise_EncryptedPrivateKey_set_version(Noise_EncryptedPrivateKey *obj, uint32_t value)
Definition: certificate.c:1901
size_t Noise_ExtraSignedInfo_count_meta(const Noise_ExtraSignedInfo *obj)
Definition: certificate.c:1750
const char * Noise_Signature_get_id(const Noise_Signature *obj)
Definition: certificate.c:1271
const char * Noise_Signature_get_name(const Noise_Signature *obj)
Definition: certificate.c:1315
Noise_PublicKeyInfo * signing_key
Definition: certificate.c:75
int noise_protobuf_read_end_element(NoiseProtobuf *pbuf, size_t end_posn)
int Noise_ExtraSignedInfo_has_valid_to(const Noise_ExtraSignedInfo *obj)
Definition: certificate.c:1697
int noise_protobuf_read_start_element(NoiseProtobuf *pbuf, int tag, size_t *end_posn)
int Noise_PrivateKey_insert_keys(Noise_PrivateKey *obj, size_t index, Noise_PrivateKeyInfo *value)
Definition: certificate.c:2363
int Noise_ExtraSignedInfo_clear_nonce(Noise_ExtraSignedInfo *obj)
Definition: certificate.c:1599
int Noise_PrivateKeyInfo_set_key(Noise_PrivateKeyInfo *obj, const void *value, size_t size)
Definition: certificate.c:2573
int Noise_SubjectInfo_has_keys(const Noise_SubjectInfo *obj)
Definition: certificate.c:722
int Noise_Certificate_read(NoiseProtobuf *pbuf, int tag, Noise_Certificate **obj)
Definition: certificate.c:167
int Noise_CertificateChain_read(NoiseProtobuf *pbuf, int tag, Noise_CertificateChain **obj)
Definition: certificate.c:369
size_t Noise_MetaInfo_get_size_name(const Noise_MetaInfo *obj)
Definition: certificate.c:1081
int noise_protobuf_read_alloc_bytes(NoiseProtobuf *pbuf, int tag, void **data, size_t max_size, size_t *size)
int Noise_SubjectInfo_has_name(const Noise_SubjectInfo *obj)
Definition: certificate.c:630
int Noise_SubjectInfo_has_role(const Noise_SubjectInfo *obj)
Definition: certificate.c:674
int Noise_Certificate_clear_version(Noise_Certificate *obj)
Definition: certificate.c:211
int Noise_EncryptedPrivateKey_read(NoiseProtobuf *pbuf, int tag, Noise_EncryptedPrivateKey **obj)
Definition: certificate.c:1830
int Noise_Certificate_new(Noise_Certificate **obj)
Definition: certificate.c:128
const char * Noise_PublicKeyInfo_get_algorithm(const Noise_PublicKeyInfo *obj)
Definition: certificate.c:916
int Noise_Signature_has_signature(const Noise_Signature *obj)
Definition: certificate.c:1470
size_t Noise_SubjectInfo_count_meta(const Noise_SubjectInfo *obj)
Definition: certificate.c:787
int Noise_PrivateKey_new(Noise_PrivateKey **obj)
Definition: certificate.c:2068
size_t Noise_PrivateKey_count_keys(const Noise_PrivateKey *obj)
Definition: certificate.c:2330