1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
|
/* libgpgme.vapi
*
* Copyright (C) 2009 Sebastian Reichel <sre@ring0.de>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
/**
* GPGME is an API wrapper around GnuPG, which parses the output of GnuPG.
*/
[CCode (lower_case_cprefix = "gpgme_", cheader_filename = "gpgme.h")]
namespace GPG {
/**
* EngineInfo as List
*/
[CCode (cname = "struct _gpgme_engine_info")]
public struct EngineInfo {
/**
* Next entry in the list
*/
EngineInfo* next;
/**
* The protocol ID
*/
Protocol protocol;
/**
* filename of the engine binary
*/
string file_name;
/**
* version string of the installed binary
*/
string version;
/**
* minimum version required for gpgme
*/
string req_version;
/**
* home directory to be used or null for default
*/
string? home_dir;
}
/**
* A Key from the Keyring
*/
[CCode (cname = "struct _gpgme_key", ref_function = "gpgme_key_ref", ref_function_void = true, unref_function = "gpgme_key_unref", free_function = "gpgme_key_release")]
public class Key {
public bool revoked;
public bool expired;
public bool disabled;
public bool invalid;
public bool can_encrypt;
public bool can_sign;
public bool can_certify;
public bool secret;
public bool can_authenticate;
public bool is_qualified;
public Protocol protocol;
/**
* If protocol is CMS, this string contains the issuer's serial
*/
public string issuer_serial;
/**
* If protocol is CMS, this string contains the issuer's name
*/
public string issuer_name;
/**
* If protocol is CMS, this string contains the issuer's ID
*/
public string issuer_id;
/**
* If protocol is OpenPGP, this field contains the owner trust level
*/
public Validity owner_trust;
/**
* The key's subkeys
*/
public SubKey* subkeys;
/**
* The key's user ids
*/
public UserID* uids;
public KeylistMode keylist_mode;
}
/**
* A signature notation
*/
[CCode (cname = "struct _gpgme_sig_notation")]
public struct SigNotation {
/**
* The next SigNotation from the list
*/
SigNotation* next;
/**
* If name is a null pointer value contains a policy url rather than a notation
*/
string? name;
/**
* The value of the notation data
*/
string value;
/**
* The length of the name of the notation data
*/
int name_len;
/**
* The length of the value of the notation data
*/
int value_len;
/**
* The accumulated flags
*/
SigNotationFlags flags;
/**
* notation data is human readable
*/
bool human_readable;
/**
* notation data is critical
*/
bool critical;
}
/**
* A subkey from a Key
*/
[CCode (cname = "struct _gpgme_subkey")]
public struct SubKey {
SubKey* next;
bool revoked;
bool expired;
bool disabled;
bool invalid;
bool can_encrypt;
bool can_sign;
bool can_certify;
bool secret;
bool can_authenticate;
bool is_qualified;
bool is_cardkey;
PublicKeyAlgorithm algo;
uint length;
string keyid;
/**
* Fingerprint of the key in hex form
*/
string fpr;
/**
* The creation timestamp.
* -1 = invalid,
* 0 = not available
*/
long timestamp;
/**
* The expiration timestamp.
* 0 = key does not expire
*/
long expires;
/**
* The serial number of the smartcard holding this key or null
*/
string? cardnumber;
}
/**
* A signature on a UserID
*/
[CCode (cname = "struct _gpgme_key_sig")]
public struct KeySig {
/**
* The next signature from the list
*/
KeySig* next;
bool invoked;
bool expired;
bool invalid;
bool exportable;
PublicKeyAlgorithm algo;
string keyid;
/**
* The creation timestamp.
* -1 = invalid,
* 0 = not available
*/
long timestamp;
/**
* The expiration timestamp.
* 0 = key does not expire
*/
long expires;
GPGError.ErrorCode status;
string uid;
string name;
string email;
string comment;
/**
* Crypto backend specific signature class
*/
uint sig_class;
SigNotation notations;
}
/**
* A UserID from a Key
*/
[CCode (cname = "struct _gpgme_user_id")]
public struct UserID {
/**
* The next UserID from the list
*/
UserID* next;
bool revoked;
bool invalid;
Validity validity;
string uid;
string name;
string email;
string comment;
KeySig signatures;
}
/**
* verify result of OP
*/
[CCode (cname = "struct _gpgme_op_verify_result")]
public struct VerifyResult {
Signature* signatures;
/**
* The original file name of the plaintext message, if available
*/
string? file_name;
}
/**
* sign result of OP
*/
[CCode (cname = "struct _gpgme_op_sign_result")]
public struct SignResult {
InvalidKey invalid_signers;
Signature* signatures;
}
/**
* encrypt result of OP
*/
[CCode (cname = "struct _gpgme_op_encrypt_result")]
public struct EncryptResult {
/**
* The list of invalid repipients
*/
InvalidKey invalid_signers;
}
/**
* decrypt result of OP
*/
[CCode (cname = "struct _gpgme_op_decrypt_result")]
public struct DecryptResult {
string unsupported_algorithm;
bool wrong_key_usage;
Recipient recipients;
string filename;
}
/**
* An receipient
*/
[CCode (cname = "struct _gpgme_recipient")]
public struct Recipient {
Recipient *next;
string keyid;
PublicKeyAlgorithm pubkey_algo;
GPGError.ErrorCode status;
}
/**
* list of invalid keys
*/
[CCode (cname = "struct _gpgme_invalid_key")]
public struct InvalidKey {
InvalidKey *next;
string fpr;
GPGError.ErrorCode reason;
}
/**
* A Signature
*/
[CCode (cname = "struct _gpgme_signature")]
public struct Signature {
/**
* The next signature in the list
*/
Signature *next;
/**
* A summary of the signature status
*/
Sigsum summary;
/**
* Fingerprint or key ID of the signature
*/
string fpr;
/**
* The Error status of the signature
*/
GPGError.ErrorCode status;
/**
* Notation data and policy URLs
*/
SigNotation notations;
/**
* Signature creation time
*/
ulong timestamp;
/**
* Signature expiration time or 0
*/
ulong exp_timestamp;
/**
* Key should not have been used for signing
*/
bool wrong_key_usage;
/**
* PKA status
*/
PKAStatus pka_trust;
/**
* Validity has been verified using the chain model
*/
bool chain_model;
/**
* Validity
*/
Validity validity;
/**
* Validity reason
*/
GPGError.ErrorCode validity_reason;
/**
* public key algorithm used to create the signature
*/
PublicKeyAlgorithm pubkey_algo;
/**
* The hash algorithm used to create the signature
*/
HashAlgorithm hash_algo;
/**
* The mailbox from the PKA information or null
*/
string? pka_adress;
}
/**
* PKA Status
*/
public enum PKAStatus {
NOT_AVAILABLE,
BAD,
OKAY,
RFU
}
/**
* Flags used for the summary field in a Signature
*/
[CCode (cname = "gpgme_sigsum_t", cprefix = "GPGME_SIGSUM_")]
public enum Sigsum {
/**
* The signature is fully valid
*/
VALID,
/**
* The signature is good
*/
GREEN,
/**
* The signature is bad
*/
RED,
/**
* One key has been revoked
*/
KEY_REVOKED,
/**
* One key has expired
*/
KEY_EXPIRED,
/**
* The signature has expired
*/
SIG_EXPIRED,
/**
* Can't verfiy - missing key
*/
KEY_MISSING,
/**
* CRL not available
*/
CRL_MISSING,
/**
* Available CRL is too old
*/
CRL_TOO_OLD,
/**
* A policy was not met
*/
BAD_POLICY,
/**
* A system error occured
*/
SYS_ERROR
}
/**
* Encoding modes of Data objects
*/
[CCode (cname = "gpgme_data_encoding_t", cprefix = "GPGME_DATA_ENCODING_")]
public enum DataEncoding {
/**
* Not specified
*/
NONE,
/**
* Binary encoded
*/
BINARY,
/**
* Base64 encoded
*/
BASE64,
/**
* Either PEM or OpenPGP Armor
*/
ARMOR,
/**
* LF delimited URL list
*/
URL,
/**
* LF percent escaped, delimited URL list
*/
URLESC,
/**
* Nul determined URL list
*/
URL0
}
/**
* Public Key Algorithms from libgcrypt
*/
[CCode (cname = "gpgme_pubkey_algo_t", cprefix = "GPGME_PK_")]
public enum PublicKeyAlgorithm {
RSA,
RSA_E,
RSA_S,
ELG_E,
DSA,
ELG
}
/**
* Hash Algorithms from libgcrypt
*/
[CCode (cname = "gpgme_hash_algo_t", cprefix = "GPGME_MD_")]
public enum HashAlgorithm {
NONE,
MD5,
SHA1,
RMD160,
MD2,
TIGER,
HAVAL,
SHA256,
SHA384,
SHA512,
MD4,
MD_CRC32,
MD_CRC32_RFC1510,
MD_CRC24_RFC2440
}
/**
* Signature modes
*/
[CCode (cname = "gpgme_sig_mode_t", cprefix = "GPGME_SIG_MODE_")]
public enum SigMode {
NORMAL,
DETACH,
CLEAR
}
/**
* Validities for a trust item or key
*/
[CCode (cname = "gpgme_validity_t", cprefix = "GPGME_VALIDITY_")]
public enum Validity {
UNKNOWN,
UNDEFINED,
NEVER,
MARGINAL,
FULL,
ULTIMATE
}
/**
* Protocols
*/
[CCode (cname = "gpgme_protocol_t", cprefix = "GPGME_PROTOCOL_")]
public enum Protocol {
/**
* Default Mode
*/
OpenPGP,
/**
* Cryptographic Message Syntax
*/
CMS,
/**
* Special code for gpgconf
*/
GPGCONF,
/**
* Low-level access to an Assuan server
*/
ASSUAN,
UNKNOWN
}
/**
* Keylist modes used by Context
*/
[CCode (cname = "gpgme_keylist_mode_t", cprefix = "GPGME_KEYLIST_MODE_")]
public enum KeylistMode {
LOCAL,
EXTERN,
SIGS,
SIG_NOTATIONS,
EPHEMERAL,
VALIDATE
}
/**
* Export modes used by Context
*/
[CCode (cname = "gpgme_export_mode_t", cprefix = "GPGME_EXPORT_MODE_")]
public enum ExportMode {
EXTERN
}
/**
* Audit log function flags
*/
[CCode (cprefix = "GPGME_AUDITLOG_")]
public enum AuditLogFlag {
HTML,
WITH_HELP
}
/**
* Signature notation flags
*/
[CCode (cname = "gpgme_sig_notation_flags_t", cprefix = "GPGME_SIG_NOTATION_")]
public enum SigNotationFlags {
HUMAN_READABLE,
CRITICAL
}
/**
* Encryption Flags
*/
[CCode (cname = "gpgme_encrypt_flags_t", cprefix = "GPGME_ENCRYPT_")]
public enum EncryptFlags {
ALWAYS_TRUST,
NO_ENCRYPT_TO
}
/**
* Edit Operation Stati
*/
[CCode (cname = "gpgme_status_code_t", cprefix = "GPGME_STATUS_")]
public enum StatusCode {
EOF,
ENTER,
LEAVE,
ABORT,
GOODSIG,
BADSIG,
ERRSIG,
BADARMOR,
RSA_OR_IDEA,
KEYEXPIRED,
KEYREVOKED,
TRUST_UNDEFINED,
TRUST_NEVER,
TRUST_MARGINAL,
TRUST_FULLY,
TRUST_ULTIMATE,
SHM_INFO,
SHM_GET,
SHM_GET_BOOL,
SHM_GET_HIDDEN,
NEED_PASSPHRASE,
VALIDSIG,
SIG_ID,
SIG_TO,
ENC_TO,
NODATA,
BAD_PASSPHRASE,
NO_PUBKEY,
NO_SECKEY,
NEED_PASSPHRASE_SYM,
DECRYPTION_FAILED,
DECRYPTION_OKAY,
MISSING_PASSPHRASE,
GOOD_PASSPHRASE,
GOODMDC,
BADMDC,
ERRMDC,
IMPORTED,
IMPORT_OK,
IMPORT_PROBLEM,
IMPORT_RES,
FILE_START,
FILE_DONE,
FILE_ERROR,
BEGIN_DECRYPTION,
END_DECRYPTION,
BEGIN_ENCRYPTION,
END_ENCRYPTION,
DELETE_PROBLEM,
GET_BOOL,
GET_LINE,
GET_HIDDEN,
GOT_IT,
PROGRESS,
SIG_CREATED,
SESSION_KEY,
NOTATION_NAME,
NOTATION_DATA,
POLICY_URL,
BEGIN_STREAM,
END_STREAM,
KEY_CREATED,
USERID_HINT,
UNEXPECTED,
INV_RECP,
NO_RECP,
ALREADY_SIGNED,
SIGEXPIRED,
EXPSIG,
EXPKEYSIG,
TRUNCATED,
ERROR,
NEWSIG,
REVKEYSIG,
SIG_SUBPACKET,
NEED_PASSPHRASE_PIN,
SC_OP_FAILURE,
SC_OP_SUCCESS,
CARDCTRL,
BACKUP_KEY_CREATED,
PKA_TRUST_BAD,
PKA_TRUST_GOOD,
PLAINTEXT
}
/**
* The Context object represents a GPG instance
*/
[Compact]
[CCode (cname = "struct gpgme_context", free_function = "gpgme_release", cprefix = "gpgme_")]
public class Context {
/**
* Create a new context, returns Error Status Code
*/
[CCode (cname = "gpgme_new")]
public static GPGError.ErrorCode Context(out Context ctx);
public GPGError.ErrorCode set_protocol(Protocol p);
public Protocol get_protocol();
public void set_armor(bool yes);
public bool get_armor();
public void set_textmode(bool yes);
public bool get_textmode();
public GPGError.ErrorCode set_keylist_mode(KeylistMode mode);
public KeylistMode get_keylist_mode();
/**
* Include up to nr_of_certs certificates in an S/MIME message,
* Use "-256" to use the backend's default.
*/
public void set_include_certs(int nr_of_certs = -256);
/**
* Return the number of certs to include in an S/MIME message
*/
public int get_include_certs();
/**
* Set callback function for requesting passphrase. hook_value will be
* passed as first argument.
*/
public void set_passphrase_cb(passphrase_callback cb, void* hook_value = null);
/**
* Get callback function and hook_value
*/
public void get_passphrase_cb(out passphrase_callback cb, out void* hook_value);
public GPGError.ErrorCode set_locale(int category, string val);
/**
* Get information about the configured engines. The returned data is valid
* until the next set_engine_info() call.
*/
[CCode (cname = "gpgme_ctx_get_engine_info")]
public EngineInfo* get_engine_info();
/**
* Set information about the configured engines. The string parameters may not
* be free'd after this calls, because they are not copied.
*/
[CCode (cname = "gpgme_ctx_set_engine_info")]
public GPGError.ErrorCode set_engine_info(Protocol proto, string file_name, string home_dir);
/**
* Delete all signers
*/
public void signers_clear();
/**
* Add key to list of signers
*/
public GPGError.ErrorCode signers_add(Key key);
/**
* Get the n-th signer's key
*/
public Key* signers_enum(int n);
/**
* Clear all notation data
*/
public void sig_notation_clear();
/**
* Add human readable notation data. If name is null,
* then value val should be a policy URL. The HUMAN_READABLE
* flag is forced to be true for notation data and false
* for policy URLs.
*/
public GPGError.ErrorCode sig_notation_add(string name, string val, SigNotationFlags flags);
/**
* Get sig notations
*/
public SigNotation* sig_notation_get();
/**
* Get key with the fingerprint FPR from the crypto backend.
* If SECRET is true, get the secret key.
*/
public GPGError.ErrorCode get_key(string fpr, out Key key, bool secret);
/**
* process the pending operation and, if hang is true, wait for
* the pending operation to finish.
*/
public Context* wait(out GPGError.ErrorCode status, bool hang);
/**
* Retrieve a pointer to the results of the signing operation
*/
public SignResult* op_sign_result();
/**
* Sign the plaintext PLAIN and store the signature in SIG.
*/
public GPGError.ErrorCode op_sign(Data plain, Data sig, SigMode mode);
/**
* Retrieve a pointer to the result of the verify operation
*/
public VerifyResult* op_verify_result();
/**
* Verify that SIG is a valid signature for SIGNED_TEXT.
*/
public GPGError.ErrorCode op_verify(Data sig, Data signed_text, Data? plaintext);
/**
* Retrieve a pointer to the result of the encrypt operation
*/
public EncryptResult* op_encrypt_result();
/**
* Encrypt plaintext PLAIN for the recipients RECP and store the
* resulting ciphertext in CIPHER.
*/
public GPGError.ErrorCode op_encrypt([CCode (array_length = false)] Key[] recp, EncryptFlags flags, Data plain, Data cipher);
/**
* Retrieve a pointer to the result of the decrypt operation
*/
public DecryptResult* op_decrypt_result();
/**
* Decrypt ciphertext CIPHER and store the resulting plaintext
* in PLAIN.
*/
public GPGError.ErrorCode op_decrypt(Data cipher, Data plain);
/**
* Export the keys found by PATTERN into KEYDATA. If PATTERN is
* NULL all keys will be exported.
*/
public GPGError.ErrorCode op_export(string? pattern, ExportMode mode, Data keydata);
/**
* Import the keys in KEYDATA.
*/
public GPGError.ErrorCode op_import(Data keydata);
/**
* Get result of last op_import.
*/
public unowned ImportResult op_import_result();
}
[Compact]
[CCode (cname = "struct _gpgme_op_import_result")]
public class ImportResult {
/**
* The total number of considered keys.
*/
public int considered;
/**
* The number of keys without user ID.
*/
public int no_user_id;
/**
* The total number of imported keys.
*/
public int imported;
/**
* The number of imported RSA keys.
*/
public int imported_rsa;
/**
* The number of unchanged keys.
*/
public int unchanged;
/**
* The number of new user IDs.
*/
public int new_user_ids;
/**
* The number of new sub keys.
*/
public int new_sub_keys;
/**
* The number of new signatures.
*/
public int new_signatures;
/**
* The number of new revocations.
*/
public int new_revocations;
/**
* The total number of secret keys read.
*/
public int secret_read;
/**
* The number of imported secret keys.
*/
public int secret_imported;
/**
* The number of unchanged secret keys.
*/
public int secret_unchanged;
/**
* The number of keys not imported.
*/
public int not_imported;
/*
* A list of gpgme import status t objects which
* contain more information about the keys for
* which an import was attempted.
* gpgme_import_status_t imports
*/
}
/**
* Data Object, contains encrypted and/or unencrypted data
*/
[Compact]
[CCode (cname = "struct gpgme_data", free_function = "gpgme_data_release", cprefix = "gpgme_data_")]
public class Data {
/**
* Create a new data buffer, returns Error Status Code.
*/
[CCode (cname = "gpgme_data_new")]
public static GPGError.ErrorCode create(out Data d);
/**
* Create a new data buffer filled with SIZE bytes starting
* from BUFFER. If COPY is false, COPYING is delayed until
* necessary and the data is taken from the original location
* when needed. Returns Error Status Code.
*/
[CCode (cname = "gpgme_data_new_from_mem")]
public static GPGError.ErrorCode create_from_memory(out Data d, uint8[] buffer, bool copy);
/**
* Create a new data buffer filled with the content of the file.
* COPY must be non-zero. For delayed read, please use
* create_from_fd or create_from stream instead.
*/
[CCode (cname = "gpgme_data_new_from_file")]
public static GPGError.ErrorCode create_from_file(out Data d, string filename, int copy = 1);
/**
* Destroy the object and return a pointer to its content.
* It's size is returned in R_LEN.
*/
[CCode (cname = "gpgme_data_release_and_get_mem")]
public string release_and_get_mem(out size_t len);
/**
* Read up to SIZE bytes into buffer BUFFER from the data object.
* Return the number of characters read, 0 on EOF and -1 on error.
* If an error occurs, errno is set.
*/
public ssize_t read(uint8[] buf);
/**
* Write up to SIZE bytes from buffer BUFFER to the data object.
* Return the number of characters written, or -1 on error.
* If an error occurs, errno is set.
*/
public ssize_t write(uint8[] buf);
/**
* Set the current position from where the next read or write
* starts in the data object to OFFSET, relativ to WHENCE.
*/
public long seek(long offset, int whence=0);
/**
* Get the encoding attribute of the buffer
*/
public DataEncoding *get_encoding();
/**
* Set the encoding attribute of the buffer to ENC
*/
public GPGError.ErrorCode set_encoding(DataEncoding enc);
}
[CCode (cname = "gpgme_get_protocol_name")]
public unowned string get_protocol_name(Protocol p);
[CCode (cname = "gpgme_pubkey_algo_name")]
public unowned string get_public_key_algorithm_name(PublicKeyAlgorithm algo);
[CCode (cname = "gpgme_hash_algo_name")]
public unowned string get_hash_algorithm_name(HashAlgorithm algo);
[CCode (cname = "gpgme_passphrase_cb_t", has_target = false)]
public delegate GPGError.ErrorCode passphrase_callback(void* hook, string uid_hint, string passphrase_info, bool prev_was_bad, int fd);
/**
* Get version of libgpgme
* Always call this function before using gpgme, it initializes some stuff
*/
[CCode (cname = "gpgme_check_version")]
public unowned string check_version(string? required_version = null);
/**
* Verify that the engine implementing proto is installed and
* available.
*/
[CCode (cname = "gpgme_engine_check_version")]
public GPGError.ErrorCode engine_check_version(Protocol proto);
/**
* Get information about the configured engines. The returned data is valid
* until the next set_engine_info() call.
*/
[CCode (cname = "gpgme_get_engine_information")]
public GPGError.ErrorCode get_engine_information(out EngineInfo engine_info);
/**
* Return the error string for ERR in the user-supplied buffer BUF
* of size BUFLEN. This function is thread-safe, if a thread-safe
* strerror_r() function is provided by the system. If the function
* succeeds, 0 is returned and BUF contains the string describing
* the error. If the buffer was not large enough, ERANGE is returned
* and BUF contains as much of the beginning of the error string as
* fits into the buffer. Returns Error Status Code.
*/
[CCode (cname = "gpgme_strerror_r")]
public int strerror_r(GPGError.ErrorCode err, uint8[] buf);
/**
* Like strerror_r, but returns a pointer to the string. This method
* is not thread safe!
*/
[CCode (cname = "gpgme_strerror")]
public unowned string strerror(GPGError.ErrorCode err);
}
|