@@ -16,15 +16,8 @@ Library for use openPGP with support for android, ios, macos, windows, linux and
16
16
- [ OpenPGP] ( #openpgp )
17
17
- [ Contents] ( #contents )
18
18
- [ Usage] ( #usage )
19
- - [ Generate methods] ( #generate-methods )
20
- - [ Encrypt methods] ( #encrypt-methods )
21
- - [ Decrypt methods] ( #decrypt-methods )
22
- - [ Sign methods] ( #sign-methods )
23
- - [ Verify methods] ( #verify-methods )
24
- - [ Encode methods] ( #encode-methods )
25
- - [ Decode methods] ( #decode-methods )
26
- - [ Metadata methods] ( #metadata-methods )
27
- - [ Convert methods] ( #convert-methods )
19
+ - [ Async methods] ( #async-methods )
20
+ - [ Sync methods] ( #sync-methods )
28
21
- [ Setup] ( #setup )
29
22
- [ Android] ( #android )
30
23
- [ iOS] ( #ios )
@@ -39,7 +32,9 @@ Library for use openPGP with support for android, ios, macos, windows, linux and
39
32
40
33
## Usage
41
34
42
- ## Generate methods
35
+ ### Async methods
36
+
37
+ #### Generate methods
43
38
``` dart
44
39
45
40
void main() async {
@@ -53,7 +48,7 @@ void main() async {
53
48
}
54
49
```
55
50
56
- ### Encrypt methods
51
+ #### Encrypt methods
57
52
58
53
``` dart
59
54
@@ -69,7 +64,7 @@ void main() async {
69
64
70
65
```
71
66
72
- ### Decrypt methods
67
+ #### Decrypt methods
73
68
74
69
``` dart
75
70
@@ -84,7 +79,7 @@ void main() async {
84
79
}
85
80
```
86
81
87
- ### Sign methods
82
+ #### Sign methods
88
83
89
84
``` dart
90
85
@@ -102,7 +97,7 @@ void main() async {
102
97
103
98
```
104
99
105
- ### Verify methods
100
+ #### Verify methods
106
101
107
102
``` dart
108
103
@@ -120,7 +115,7 @@ void main() async {
120
115
121
116
```
122
117
123
- ### Encode methods
118
+ #### Encode methods
124
119
125
120
``` dart
126
121
@@ -131,7 +126,7 @@ void main() async {
131
126
}
132
127
133
128
```
134
- ### Decode methods
129
+ #### Decode methods
135
130
136
131
``` dart
137
132
@@ -142,7 +137,7 @@ void main() async {
142
137
```
143
138
144
139
145
- ### Metadata methods
140
+ #### Metadata methods
146
141
147
142
``` dart
148
143
@@ -154,7 +149,7 @@ void main() async {
154
149
```
155
150
156
151
157
- ### Convert methods
152
+ #### Convert methods
158
153
159
154
``` dart
160
155
@@ -164,6 +159,133 @@ void main() async {
164
159
165
160
```
166
161
162
+ ### Sync methods
163
+
164
+ #### Generate methods
165
+ ``` dart
166
+
167
+ void main() {
168
+ var keyOptions = KeyOptions()..rsaBits = 2048;
169
+ var keyPair = OpenPGPSync.generate(
170
+ options: Options()
171
+ ..name = 'test'
172
+
173
+ ..passphrase = passphrase
174
+ ..keyOptions = keyOptions);
175
+ }
176
+ ```
177
+
178
+ #### Encrypt methods
179
+
180
+ ``` dart
181
+
182
+ void main() async {
183
+ var bytesSample = Uint8List.fromList('data'.codeUnits);
184
+
185
+ var result = OpenPGPSync.encrypt("text","[publicKey here]");
186
+ var result = OpenPGPSync.encryptSymmetric("text","[passphrase here]");
187
+ var result = OpenPGPSync.encryptBytes(bytesSample,"[publicKey here]");
188
+ var result = OpenPGPSync.encryptSymmetricBytes(bytesSample,"[passphrase here]");
189
+
190
+ }
191
+
192
+ ```
193
+
194
+ #### Decrypt methods
195
+
196
+ ``` dart
197
+
198
+ void main() async {
199
+ var bytesSample = Uint8List.fromList('data'.codeUnits);
200
+
201
+ var result = OpenPGPSync.decrypt("text encrypted","[privateKey here]","[passphrase here]");
202
+ var result = OpenPGPSync.decryptSymmetric("text encrypted","[passphrase here]");
203
+ var result = OpenPGPSync.decryptBytes(bytesSample,"[privateKey here]","[passphrase here]");
204
+ var result = OpenPGPSync.decryptSymmetricBytes(bytesSample,"[passphrase here]");
205
+
206
+ }
207
+ ```
208
+
209
+ #### Sign methods
210
+
211
+ ``` dart
212
+
213
+ void main() async {
214
+ var bytesSample = Uint8List.fromList('data'.codeUnits);
215
+
216
+ var result = OpenPGPSync.sign("text","[privateKey here]","[passphrase here]");
217
+ var result = OpenPGPSync.signBytesToString(bytesSample,"[privateKey here]","[passphrase here]");
218
+
219
+ // sign including data
220
+ var result = OpenPGPSync.signData("text","[privateKey here]","[passphrase here]");
221
+ var result = OpenPGPSync.signDataBytesToString(bytesSample,"[privateKey here]","[passphrase here]");
222
+
223
+ }
224
+
225
+ ```
226
+
227
+ #### Verify methods
228
+
229
+ ``` dart
230
+
231
+ void main() async {
232
+ var bytesSample = Uint8List.fromList('data'.codeUnits);
233
+
234
+ var result = OpenPGPSync.verify("text signed","text","[publicKey here]");
235
+ var result = OpenPGPSync.verifyBytes("text signed", bytesSample,"[publicKey here]");
236
+
237
+ // verify signed with data
238
+ var result = OpenPGPSync.verifyData("text signed","[publicKey here]");
239
+ var result = OpenPGPSync.verifyDataBytes(bytesSample,"[publicKey here]");
240
+
241
+ }
242
+
243
+ ```
244
+
245
+ #### Encode methods
246
+
247
+ ``` dart
248
+
249
+ void main() async {
250
+ var bytesSample = Uint8List.fromList('data'.codeUnits);
251
+
252
+ var result = OpenPGPSync.armorEncode("PGP MESSAGE", bytesSample);
253
+ }
254
+
255
+ ```
256
+ #### Decode methods
257
+
258
+ ``` dart
259
+
260
+ void main() async {
261
+ var result = OpenPGPSync.armorDecode("message here");
262
+ }
263
+
264
+ ```
265
+
266
+
267
+ #### Metadata methods
268
+
269
+ ``` dart
270
+
271
+ void main() async {
272
+ var result = OpenPGPSync.getPrivateKeyMetadata("[privateKey here]");
273
+ var result = OpenPGPSync.getPublicKeyMetadata("[publicKey here]");
274
+ }
275
+
276
+ ```
277
+
278
+
279
+ #### Convert methods
280
+
281
+ ``` dart
282
+
283
+ void main() async {
284
+ var result = OpenPGPSync.convertPrivateKeyToPublicKey("[privateKey here]");
285
+ }
286
+
287
+ ```
288
+
167
289
## Setup
168
290
169
291
### Android
0 commit comments