├── .gitignore ├── LICENSE ├── README.md ├── create_keys_and_use ├── Cargo.lock ├── Cargo.toml ├── README.md └── src │ └── main.rs └── keys_from_files ├── Cargo.lock ├── Cargo.toml ├── README.md ├── key_files ├── pub.asc └── sec.asc ├── pgp_decrypter.py ├── pgp_encrypter.py └── src └── main.rs /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | encrypted_message.txt -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # rPGP Working Examples 2 | 3 | A list of non-contrived working examples of the Rust rPGP library to help others attempting to use this library. 4 | 5 | Please see the [rPGP](https://github.com/rpgp/rpgp) repo and the [crate documentation](https://docs.rs/pgp/0.9.0/pgp/) for more specific information on Friedel Ziegelmayer's work. 6 | 7 | Each example will typically include: 8 | - A README.md file with a description of the example 9 | - A secret message to be encrypted. This might be hard coded or read from a file, or passed in as a command line argument. 10 | - An encryption process, and a decryption process. 11 | - Some trivial output to show that the encryption and decryption worked. 12 | 13 | By non-contrived, I mean that the examples will not take shortcuts that preclude them from being applicable to actual use. 14 | 15 | I found this to be a pain point in the existing examples and tests included with the library, so I wanted to provide some examples that are more applicable to real world use cases. 16 | 17 | Each example presented is from a real world use case that is paired down to the bare minimum to demonstrate the use of the library. 18 | 19 | This may make it appear to be doing things that are unnecessary in the context of the example, but it is done to demonstrate the practical uses of the library. -------------------------------------------------------------------------------- /create_keys_and_use/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "adler" 7 | version = "1.0.2" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 10 | 11 | [[package]] 12 | name = "aes" 13 | version = "0.8.2" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "433cfd6710c9986c576a25ca913c39d66a6474107b406f34f91d4a8923395241" 16 | dependencies = [ 17 | "cfg-if", 18 | "cipher", 19 | "cpufeatures", 20 | ] 21 | 22 | [[package]] 23 | name = "android_system_properties" 24 | version = "0.1.5" 25 | source = "registry+https://github.com/rust-lang/crates.io-index" 26 | checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" 27 | dependencies = [ 28 | "libc", 29 | ] 30 | 31 | [[package]] 32 | name = "anyhow" 33 | version = "1.0.68" 34 | source = "registry+https://github.com/rust-lang/crates.io-index" 35 | checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" 36 | 37 | [[package]] 38 | name = "autocfg" 39 | version = "1.1.0" 40 | source = "registry+https://github.com/rust-lang/crates.io-index" 41 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 42 | 43 | [[package]] 44 | name = "base64" 45 | version = "0.13.1" 46 | source = "registry+https://github.com/rust-lang/crates.io-index" 47 | checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" 48 | 49 | [[package]] 50 | name = "base64ct" 51 | version = "1.5.3" 52 | source = "registry+https://github.com/rust-lang/crates.io-index" 53 | checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" 54 | 55 | [[package]] 56 | name = "bitfield" 57 | version = "0.14.0" 58 | source = "registry+https://github.com/rust-lang/crates.io-index" 59 | checksum = "2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac" 60 | 61 | [[package]] 62 | name = "block-buffer" 63 | version = "0.9.0" 64 | source = "registry+https://github.com/rust-lang/crates.io-index" 65 | checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" 66 | dependencies = [ 67 | "generic-array", 68 | ] 69 | 70 | [[package]] 71 | name = "block-buffer" 72 | version = "0.10.3" 73 | source = "registry+https://github.com/rust-lang/crates.io-index" 74 | checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" 75 | dependencies = [ 76 | "generic-array", 77 | ] 78 | 79 | [[package]] 80 | name = "block-padding" 81 | version = "0.3.2" 82 | source = "registry+https://github.com/rust-lang/crates.io-index" 83 | checksum = "0a90ec2df9600c28a01c56c4784c9207a96d2451833aeceb8cc97e4c9548bb78" 84 | dependencies = [ 85 | "generic-array", 86 | ] 87 | 88 | [[package]] 89 | name = "blowfish" 90 | version = "0.9.1" 91 | source = "registry+https://github.com/rust-lang/crates.io-index" 92 | checksum = "e412e2cd0f2b2d93e02543ceae7917b3c70331573df19ee046bcbc35e45e87d7" 93 | dependencies = [ 94 | "byteorder", 95 | "cipher", 96 | ] 97 | 98 | [[package]] 99 | name = "buf_redux" 100 | version = "0.8.4" 101 | source = "registry+https://github.com/rust-lang/crates.io-index" 102 | checksum = "b953a6887648bb07a535631f2bc00fbdb2a2216f135552cb3f534ed136b9c07f" 103 | dependencies = [ 104 | "memchr", 105 | "safemem", 106 | ] 107 | 108 | [[package]] 109 | name = "bumpalo" 110 | version = "3.11.1" 111 | source = "registry+https://github.com/rust-lang/crates.io-index" 112 | checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" 113 | 114 | [[package]] 115 | name = "byteorder" 116 | version = "1.4.3" 117 | source = "registry+https://github.com/rust-lang/crates.io-index" 118 | checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" 119 | 120 | [[package]] 121 | name = "cast5" 122 | version = "0.11.1" 123 | source = "registry+https://github.com/rust-lang/crates.io-index" 124 | checksum = "26b07d673db1ccf000e90f54b819db9e75a8348d6eb056e9b8ab53231b7a9911" 125 | dependencies = [ 126 | "cipher", 127 | ] 128 | 129 | [[package]] 130 | name = "cc" 131 | version = "1.0.78" 132 | source = "registry+https://github.com/rust-lang/crates.io-index" 133 | checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" 134 | 135 | [[package]] 136 | name = "cfb-mode" 137 | version = "0.8.2" 138 | source = "registry+https://github.com/rust-lang/crates.io-index" 139 | checksum = "738b8d467867f80a71351933f70461f5b56f24d5c93e0cf216e59229c968d330" 140 | dependencies = [ 141 | "cipher", 142 | ] 143 | 144 | [[package]] 145 | name = "cfg-if" 146 | version = "1.0.0" 147 | source = "registry+https://github.com/rust-lang/crates.io-index" 148 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 149 | 150 | [[package]] 151 | name = "chrono" 152 | version = "0.4.23" 153 | source = "registry+https://github.com/rust-lang/crates.io-index" 154 | checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" 155 | dependencies = [ 156 | "iana-time-zone", 157 | "num-integer", 158 | "num-traits", 159 | "winapi", 160 | ] 161 | 162 | [[package]] 163 | name = "cipher" 164 | version = "0.4.3" 165 | source = "registry+https://github.com/rust-lang/crates.io-index" 166 | checksum = "d1873270f8f7942c191139cb8a40fd228da6c3fd2fc376d7e92d47aa14aeb59e" 167 | dependencies = [ 168 | "crypto-common", 169 | "inout", 170 | ] 171 | 172 | [[package]] 173 | name = "codespan-reporting" 174 | version = "0.11.1" 175 | source = "registry+https://github.com/rust-lang/crates.io-index" 176 | checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" 177 | dependencies = [ 178 | "termcolor", 179 | "unicode-width", 180 | ] 181 | 182 | [[package]] 183 | name = "const-oid" 184 | version = "0.9.1" 185 | source = "registry+https://github.com/rust-lang/crates.io-index" 186 | checksum = "cec318a675afcb6a1ea1d4340e2d377e56e47c266f28043ceccbf4412ddfdd3b" 187 | 188 | [[package]] 189 | name = "core-foundation-sys" 190 | version = "0.8.3" 191 | source = "registry+https://github.com/rust-lang/crates.io-index" 192 | checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" 193 | 194 | [[package]] 195 | name = "cpufeatures" 196 | version = "0.2.5" 197 | source = "registry+https://github.com/rust-lang/crates.io-index" 198 | checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" 199 | dependencies = [ 200 | "libc", 201 | ] 202 | 203 | [[package]] 204 | name = "crc24" 205 | version = "0.1.6" 206 | source = "registry+https://github.com/rust-lang/crates.io-index" 207 | checksum = "fd121741cf3eb82c08dd3023eb55bf2665e5f60ec20f89760cf836ae4562e6a0" 208 | 209 | [[package]] 210 | name = "crc32fast" 211 | version = "1.3.2" 212 | source = "registry+https://github.com/rust-lang/crates.io-index" 213 | checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" 214 | dependencies = [ 215 | "cfg-if", 216 | ] 217 | 218 | [[package]] 219 | name = "create_keys_and_use" 220 | version = "0.1.0" 221 | dependencies = [ 222 | "anyhow", 223 | "pgp", 224 | "rand 0.8.5", 225 | "smallvec", 226 | ] 227 | 228 | [[package]] 229 | name = "crypto-common" 230 | version = "0.1.6" 231 | source = "registry+https://github.com/rust-lang/crates.io-index" 232 | checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" 233 | dependencies = [ 234 | "generic-array", 235 | "typenum", 236 | ] 237 | 238 | [[package]] 239 | name = "curve25519-dalek" 240 | version = "3.2.0" 241 | source = "registry+https://github.com/rust-lang/crates.io-index" 242 | checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" 243 | dependencies = [ 244 | "byteorder", 245 | "digest 0.9.0", 246 | "rand_core 0.5.1", 247 | "subtle", 248 | "zeroize", 249 | ] 250 | 251 | [[package]] 252 | name = "cxx" 253 | version = "1.0.85" 254 | source = "registry+https://github.com/rust-lang/crates.io-index" 255 | checksum = "5add3fc1717409d029b20c5b6903fc0c0b02fa6741d820054f4a2efa5e5816fd" 256 | dependencies = [ 257 | "cc", 258 | "cxxbridge-flags", 259 | "cxxbridge-macro", 260 | "link-cplusplus", 261 | ] 262 | 263 | [[package]] 264 | name = "cxx-build" 265 | version = "1.0.85" 266 | source = "registry+https://github.com/rust-lang/crates.io-index" 267 | checksum = "b4c87959ba14bc6fbc61df77c3fcfe180fc32b93538c4f1031dd802ccb5f2ff0" 268 | dependencies = [ 269 | "cc", 270 | "codespan-reporting", 271 | "once_cell", 272 | "proc-macro2", 273 | "quote", 274 | "scratch", 275 | "syn", 276 | ] 277 | 278 | [[package]] 279 | name = "cxxbridge-flags" 280 | version = "1.0.85" 281 | source = "registry+https://github.com/rust-lang/crates.io-index" 282 | checksum = "69a3e162fde4e594ed2b07d0f83c6c67b745e7f28ce58c6df5e6b6bef99dfb59" 283 | 284 | [[package]] 285 | name = "cxxbridge-macro" 286 | version = "1.0.85" 287 | source = "registry+https://github.com/rust-lang/crates.io-index" 288 | checksum = "3e7e2adeb6a0d4a282e581096b06e1791532b7d576dcde5ccd9382acf55db8e6" 289 | dependencies = [ 290 | "proc-macro2", 291 | "quote", 292 | "syn", 293 | ] 294 | 295 | [[package]] 296 | name = "darling" 297 | version = "0.14.2" 298 | source = "registry+https://github.com/rust-lang/crates.io-index" 299 | checksum = "b0dd3cd20dc6b5a876612a6e5accfe7f3dd883db6d07acfbf14c128f61550dfa" 300 | dependencies = [ 301 | "darling_core", 302 | "darling_macro", 303 | ] 304 | 305 | [[package]] 306 | name = "darling_core" 307 | version = "0.14.2" 308 | source = "registry+https://github.com/rust-lang/crates.io-index" 309 | checksum = "a784d2ccaf7c98501746bf0be29b2022ba41fd62a2e622af997a03e9f972859f" 310 | dependencies = [ 311 | "fnv", 312 | "ident_case", 313 | "proc-macro2", 314 | "quote", 315 | "strsim", 316 | "syn", 317 | ] 318 | 319 | [[package]] 320 | name = "darling_macro" 321 | version = "0.14.2" 322 | source = "registry+https://github.com/rust-lang/crates.io-index" 323 | checksum = "7618812407e9402654622dd402b0a89dff9ba93badd6540781526117b92aab7e" 324 | dependencies = [ 325 | "darling_core", 326 | "quote", 327 | "syn", 328 | ] 329 | 330 | [[package]] 331 | name = "der" 332 | version = "0.6.1" 333 | source = "registry+https://github.com/rust-lang/crates.io-index" 334 | checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" 335 | dependencies = [ 336 | "const-oid", 337 | "pem-rfc7468", 338 | "zeroize", 339 | ] 340 | 341 | [[package]] 342 | name = "derive_builder" 343 | version = "0.11.2" 344 | source = "registry+https://github.com/rust-lang/crates.io-index" 345 | checksum = "d07adf7be193b71cc36b193d0f5fe60b918a3a9db4dad0449f57bcfd519704a3" 346 | dependencies = [ 347 | "derive_builder_macro", 348 | ] 349 | 350 | [[package]] 351 | name = "derive_builder_core" 352 | version = "0.11.2" 353 | source = "registry+https://github.com/rust-lang/crates.io-index" 354 | checksum = "1f91d4cfa921f1c05904dc3c57b4a32c38aed3340cce209f3a6fd1478babafc4" 355 | dependencies = [ 356 | "darling", 357 | "proc-macro2", 358 | "quote", 359 | "syn", 360 | ] 361 | 362 | [[package]] 363 | name = "derive_builder_macro" 364 | version = "0.11.2" 365 | source = "registry+https://github.com/rust-lang/crates.io-index" 366 | checksum = "8f0314b72bed045f3a68671b3c86328386762c93f82d98c65c3cb5e5f573dd68" 367 | dependencies = [ 368 | "derive_builder_core", 369 | "syn", 370 | ] 371 | 372 | [[package]] 373 | name = "des" 374 | version = "0.8.1" 375 | source = "registry+https://github.com/rust-lang/crates.io-index" 376 | checksum = "ffdd80ce8ce993de27e9f063a444a4d53ce8e8db4c1f00cc03af5ad5a9867a1e" 377 | dependencies = [ 378 | "cipher", 379 | ] 380 | 381 | [[package]] 382 | name = "digest" 383 | version = "0.9.0" 384 | source = "registry+https://github.com/rust-lang/crates.io-index" 385 | checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" 386 | dependencies = [ 387 | "generic-array", 388 | ] 389 | 390 | [[package]] 391 | name = "digest" 392 | version = "0.10.6" 393 | source = "registry+https://github.com/rust-lang/crates.io-index" 394 | checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" 395 | dependencies = [ 396 | "block-buffer 0.10.3", 397 | "const-oid", 398 | "crypto-common", 399 | ] 400 | 401 | [[package]] 402 | name = "ed25519" 403 | version = "1.5.2" 404 | source = "registry+https://github.com/rust-lang/crates.io-index" 405 | checksum = "1e9c280362032ea4203659fc489832d0204ef09f247a0506f170dafcac08c369" 406 | dependencies = [ 407 | "signature", 408 | ] 409 | 410 | [[package]] 411 | name = "ed25519-dalek" 412 | version = "1.0.1" 413 | source = "registry+https://github.com/rust-lang/crates.io-index" 414 | checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" 415 | dependencies = [ 416 | "curve25519-dalek", 417 | "ed25519", 418 | "rand 0.7.3", 419 | "serde", 420 | "sha2 0.9.9", 421 | "zeroize", 422 | ] 423 | 424 | [[package]] 425 | name = "flate2" 426 | version = "1.0.25" 427 | source = "registry+https://github.com/rust-lang/crates.io-index" 428 | checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" 429 | dependencies = [ 430 | "crc32fast", 431 | "miniz_oxide", 432 | ] 433 | 434 | [[package]] 435 | name = "fnv" 436 | version = "1.0.7" 437 | source = "registry+https://github.com/rust-lang/crates.io-index" 438 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 439 | 440 | [[package]] 441 | name = "generic-array" 442 | version = "0.14.6" 443 | source = "registry+https://github.com/rust-lang/crates.io-index" 444 | checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" 445 | dependencies = [ 446 | "typenum", 447 | "version_check 0.9.4", 448 | ] 449 | 450 | [[package]] 451 | name = "getrandom" 452 | version = "0.1.16" 453 | source = "registry+https://github.com/rust-lang/crates.io-index" 454 | checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" 455 | dependencies = [ 456 | "cfg-if", 457 | "libc", 458 | "wasi 0.9.0+wasi-snapshot-preview1", 459 | ] 460 | 461 | [[package]] 462 | name = "getrandom" 463 | version = "0.2.8" 464 | source = "registry+https://github.com/rust-lang/crates.io-index" 465 | checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" 466 | dependencies = [ 467 | "cfg-if", 468 | "libc", 469 | "wasi 0.11.0+wasi-snapshot-preview1", 470 | ] 471 | 472 | [[package]] 473 | name = "hex" 474 | version = "0.4.3" 475 | source = "registry+https://github.com/rust-lang/crates.io-index" 476 | checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" 477 | 478 | [[package]] 479 | name = "iana-time-zone" 480 | version = "0.1.53" 481 | source = "registry+https://github.com/rust-lang/crates.io-index" 482 | checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" 483 | dependencies = [ 484 | "android_system_properties", 485 | "core-foundation-sys", 486 | "iana-time-zone-haiku", 487 | "js-sys", 488 | "wasm-bindgen", 489 | "winapi", 490 | ] 491 | 492 | [[package]] 493 | name = "iana-time-zone-haiku" 494 | version = "0.1.1" 495 | source = "registry+https://github.com/rust-lang/crates.io-index" 496 | checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" 497 | dependencies = [ 498 | "cxx", 499 | "cxx-build", 500 | ] 501 | 502 | [[package]] 503 | name = "ident_case" 504 | version = "1.0.1" 505 | source = "registry+https://github.com/rust-lang/crates.io-index" 506 | checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" 507 | 508 | [[package]] 509 | name = "inout" 510 | version = "0.1.3" 511 | source = "registry+https://github.com/rust-lang/crates.io-index" 512 | checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" 513 | dependencies = [ 514 | "generic-array", 515 | ] 516 | 517 | [[package]] 518 | name = "js-sys" 519 | version = "0.3.60" 520 | source = "registry+https://github.com/rust-lang/crates.io-index" 521 | checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" 522 | dependencies = [ 523 | "wasm-bindgen", 524 | ] 525 | 526 | [[package]] 527 | name = "keccak" 528 | version = "0.1.3" 529 | source = "registry+https://github.com/rust-lang/crates.io-index" 530 | checksum = "3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768" 531 | dependencies = [ 532 | "cpufeatures", 533 | ] 534 | 535 | [[package]] 536 | name = "lazy_static" 537 | version = "1.4.0" 538 | source = "registry+https://github.com/rust-lang/crates.io-index" 539 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 540 | dependencies = [ 541 | "spin", 542 | ] 543 | 544 | [[package]] 545 | name = "libc" 546 | version = "0.2.139" 547 | source = "registry+https://github.com/rust-lang/crates.io-index" 548 | checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" 549 | 550 | [[package]] 551 | name = "libm" 552 | version = "0.2.6" 553 | source = "registry+https://github.com/rust-lang/crates.io-index" 554 | checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" 555 | 556 | [[package]] 557 | name = "link-cplusplus" 558 | version = "1.0.8" 559 | source = "registry+https://github.com/rust-lang/crates.io-index" 560 | checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" 561 | dependencies = [ 562 | "cc", 563 | ] 564 | 565 | [[package]] 566 | name = "log" 567 | version = "0.4.17" 568 | source = "registry+https://github.com/rust-lang/crates.io-index" 569 | checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" 570 | dependencies = [ 571 | "cfg-if", 572 | ] 573 | 574 | [[package]] 575 | name = "md-5" 576 | version = "0.10.5" 577 | source = "registry+https://github.com/rust-lang/crates.io-index" 578 | checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" 579 | dependencies = [ 580 | "digest 0.10.6", 581 | ] 582 | 583 | [[package]] 584 | name = "memchr" 585 | version = "2.5.0" 586 | source = "registry+https://github.com/rust-lang/crates.io-index" 587 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" 588 | 589 | [[package]] 590 | name = "miniz_oxide" 591 | version = "0.6.2" 592 | source = "registry+https://github.com/rust-lang/crates.io-index" 593 | checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" 594 | dependencies = [ 595 | "adler", 596 | ] 597 | 598 | [[package]] 599 | name = "nom" 600 | version = "4.2.3" 601 | source = "registry+https://github.com/rust-lang/crates.io-index" 602 | checksum = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6" 603 | dependencies = [ 604 | "memchr", 605 | "version_check 0.1.5", 606 | ] 607 | 608 | [[package]] 609 | name = "num-bigint-dig" 610 | version = "0.8.2" 611 | source = "registry+https://github.com/rust-lang/crates.io-index" 612 | checksum = "2399c9463abc5f909349d8aa9ba080e0b88b3ce2885389b60b993f39b1a56905" 613 | dependencies = [ 614 | "byteorder", 615 | "lazy_static", 616 | "libm", 617 | "num-integer", 618 | "num-iter", 619 | "num-traits", 620 | "rand 0.8.5", 621 | "serde", 622 | "smallvec", 623 | "zeroize", 624 | ] 625 | 626 | [[package]] 627 | name = "num-derive" 628 | version = "0.3.3" 629 | source = "registry+https://github.com/rust-lang/crates.io-index" 630 | checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" 631 | dependencies = [ 632 | "proc-macro2", 633 | "quote", 634 | "syn", 635 | ] 636 | 637 | [[package]] 638 | name = "num-integer" 639 | version = "0.1.45" 640 | source = "registry+https://github.com/rust-lang/crates.io-index" 641 | checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" 642 | dependencies = [ 643 | "autocfg", 644 | "num-traits", 645 | ] 646 | 647 | [[package]] 648 | name = "num-iter" 649 | version = "0.1.43" 650 | source = "registry+https://github.com/rust-lang/crates.io-index" 651 | checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" 652 | dependencies = [ 653 | "autocfg", 654 | "num-integer", 655 | "num-traits", 656 | ] 657 | 658 | [[package]] 659 | name = "num-traits" 660 | version = "0.2.15" 661 | source = "registry+https://github.com/rust-lang/crates.io-index" 662 | checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" 663 | dependencies = [ 664 | "autocfg", 665 | "libm", 666 | ] 667 | 668 | [[package]] 669 | name = "once_cell" 670 | version = "1.17.0" 671 | source = "registry+https://github.com/rust-lang/crates.io-index" 672 | checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" 673 | 674 | [[package]] 675 | name = "opaque-debug" 676 | version = "0.3.0" 677 | source = "registry+https://github.com/rust-lang/crates.io-index" 678 | checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" 679 | 680 | [[package]] 681 | name = "pem-rfc7468" 682 | version = "0.6.0" 683 | source = "registry+https://github.com/rust-lang/crates.io-index" 684 | checksum = "24d159833a9105500e0398934e205e0773f0b27529557134ecfc51c27646adac" 685 | dependencies = [ 686 | "base64ct", 687 | ] 688 | 689 | [[package]] 690 | name = "pgp" 691 | version = "0.9.0" 692 | source = "registry+https://github.com/rust-lang/crates.io-index" 693 | checksum = "991e3f098483f52c454c7cb16720adc010c2966a8845d3c34aad589cb86d3196" 694 | dependencies = [ 695 | "aes", 696 | "base64", 697 | "bitfield", 698 | "block-padding", 699 | "blowfish", 700 | "buf_redux", 701 | "byteorder", 702 | "cast5", 703 | "cfb-mode", 704 | "chrono", 705 | "cipher", 706 | "crc24", 707 | "derive_builder", 708 | "des", 709 | "digest 0.10.6", 710 | "ed25519-dalek", 711 | "flate2", 712 | "generic-array", 713 | "hex", 714 | "log", 715 | "md-5", 716 | "nom", 717 | "num-bigint-dig", 718 | "num-derive", 719 | "num-traits", 720 | "rand 0.8.5", 721 | "ripemd", 722 | "rsa", 723 | "sha1", 724 | "sha2 0.10.6", 725 | "sha3", 726 | "signature", 727 | "smallvec", 728 | "thiserror", 729 | "twofish", 730 | "x25519-dalek", 731 | "zeroize", 732 | ] 733 | 734 | [[package]] 735 | name = "pkcs1" 736 | version = "0.4.1" 737 | source = "registry+https://github.com/rust-lang/crates.io-index" 738 | checksum = "eff33bdbdfc54cc98a2eca766ebdec3e1b8fb7387523d5c9c9a2891da856f719" 739 | dependencies = [ 740 | "der", 741 | "pkcs8", 742 | "spki", 743 | "zeroize", 744 | ] 745 | 746 | [[package]] 747 | name = "pkcs8" 748 | version = "0.9.0" 749 | source = "registry+https://github.com/rust-lang/crates.io-index" 750 | checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" 751 | dependencies = [ 752 | "der", 753 | "spki", 754 | ] 755 | 756 | [[package]] 757 | name = "ppv-lite86" 758 | version = "0.2.17" 759 | source = "registry+https://github.com/rust-lang/crates.io-index" 760 | checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" 761 | 762 | [[package]] 763 | name = "proc-macro2" 764 | version = "1.0.49" 765 | source = "registry+https://github.com/rust-lang/crates.io-index" 766 | checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" 767 | dependencies = [ 768 | "unicode-ident", 769 | ] 770 | 771 | [[package]] 772 | name = "quote" 773 | version = "1.0.23" 774 | source = "registry+https://github.com/rust-lang/crates.io-index" 775 | checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" 776 | dependencies = [ 777 | "proc-macro2", 778 | ] 779 | 780 | [[package]] 781 | name = "rand" 782 | version = "0.7.3" 783 | source = "registry+https://github.com/rust-lang/crates.io-index" 784 | checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" 785 | dependencies = [ 786 | "getrandom 0.1.16", 787 | "libc", 788 | "rand_chacha 0.2.2", 789 | "rand_core 0.5.1", 790 | "rand_hc", 791 | ] 792 | 793 | [[package]] 794 | name = "rand" 795 | version = "0.8.5" 796 | source = "registry+https://github.com/rust-lang/crates.io-index" 797 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 798 | dependencies = [ 799 | "libc", 800 | "rand_chacha 0.3.1", 801 | "rand_core 0.6.4", 802 | ] 803 | 804 | [[package]] 805 | name = "rand_chacha" 806 | version = "0.2.2" 807 | source = "registry+https://github.com/rust-lang/crates.io-index" 808 | checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" 809 | dependencies = [ 810 | "ppv-lite86", 811 | "rand_core 0.5.1", 812 | ] 813 | 814 | [[package]] 815 | name = "rand_chacha" 816 | version = "0.3.1" 817 | source = "registry+https://github.com/rust-lang/crates.io-index" 818 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 819 | dependencies = [ 820 | "ppv-lite86", 821 | "rand_core 0.6.4", 822 | ] 823 | 824 | [[package]] 825 | name = "rand_core" 826 | version = "0.5.1" 827 | source = "registry+https://github.com/rust-lang/crates.io-index" 828 | checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" 829 | dependencies = [ 830 | "getrandom 0.1.16", 831 | ] 832 | 833 | [[package]] 834 | name = "rand_core" 835 | version = "0.6.4" 836 | source = "registry+https://github.com/rust-lang/crates.io-index" 837 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 838 | dependencies = [ 839 | "getrandom 0.2.8", 840 | ] 841 | 842 | [[package]] 843 | name = "rand_hc" 844 | version = "0.2.0" 845 | source = "registry+https://github.com/rust-lang/crates.io-index" 846 | checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" 847 | dependencies = [ 848 | "rand_core 0.5.1", 849 | ] 850 | 851 | [[package]] 852 | name = "ripemd" 853 | version = "0.1.3" 854 | source = "registry+https://github.com/rust-lang/crates.io-index" 855 | checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" 856 | dependencies = [ 857 | "digest 0.10.6", 858 | ] 859 | 860 | [[package]] 861 | name = "rsa" 862 | version = "0.7.2" 863 | source = "registry+https://github.com/rust-lang/crates.io-index" 864 | checksum = "094052d5470cbcef561cb848a7209968c9f12dfa6d668f4bca048ac5de51099c" 865 | dependencies = [ 866 | "byteorder", 867 | "digest 0.10.6", 868 | "num-bigint-dig", 869 | "num-integer", 870 | "num-iter", 871 | "num-traits", 872 | "pkcs1", 873 | "pkcs8", 874 | "rand_core 0.6.4", 875 | "signature", 876 | "smallvec", 877 | "subtle", 878 | "zeroize", 879 | ] 880 | 881 | [[package]] 882 | name = "safemem" 883 | version = "0.3.3" 884 | source = "registry+https://github.com/rust-lang/crates.io-index" 885 | checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" 886 | 887 | [[package]] 888 | name = "scratch" 889 | version = "1.0.3" 890 | source = "registry+https://github.com/rust-lang/crates.io-index" 891 | checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" 892 | 893 | [[package]] 894 | name = "serde" 895 | version = "1.0.152" 896 | source = "registry+https://github.com/rust-lang/crates.io-index" 897 | checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" 898 | 899 | [[package]] 900 | name = "sha1" 901 | version = "0.10.5" 902 | source = "registry+https://github.com/rust-lang/crates.io-index" 903 | checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" 904 | dependencies = [ 905 | "cfg-if", 906 | "cpufeatures", 907 | "digest 0.10.6", 908 | ] 909 | 910 | [[package]] 911 | name = "sha2" 912 | version = "0.9.9" 913 | source = "registry+https://github.com/rust-lang/crates.io-index" 914 | checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" 915 | dependencies = [ 916 | "block-buffer 0.9.0", 917 | "cfg-if", 918 | "cpufeatures", 919 | "digest 0.9.0", 920 | "opaque-debug", 921 | ] 922 | 923 | [[package]] 924 | name = "sha2" 925 | version = "0.10.6" 926 | source = "registry+https://github.com/rust-lang/crates.io-index" 927 | checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" 928 | dependencies = [ 929 | "cfg-if", 930 | "cpufeatures", 931 | "digest 0.10.6", 932 | ] 933 | 934 | [[package]] 935 | name = "sha3" 936 | version = "0.10.6" 937 | source = "registry+https://github.com/rust-lang/crates.io-index" 938 | checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" 939 | dependencies = [ 940 | "digest 0.10.6", 941 | "keccak", 942 | ] 943 | 944 | [[package]] 945 | name = "signature" 946 | version = "1.6.4" 947 | source = "registry+https://github.com/rust-lang/crates.io-index" 948 | checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" 949 | dependencies = [ 950 | "digest 0.10.6", 951 | "rand_core 0.6.4", 952 | ] 953 | 954 | [[package]] 955 | name = "smallvec" 956 | version = "1.10.0" 957 | source = "registry+https://github.com/rust-lang/crates.io-index" 958 | checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" 959 | 960 | [[package]] 961 | name = "spin" 962 | version = "0.5.2" 963 | source = "registry+https://github.com/rust-lang/crates.io-index" 964 | checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" 965 | 966 | [[package]] 967 | name = "spki" 968 | version = "0.6.0" 969 | source = "registry+https://github.com/rust-lang/crates.io-index" 970 | checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" 971 | dependencies = [ 972 | "base64ct", 973 | "der", 974 | ] 975 | 976 | [[package]] 977 | name = "strsim" 978 | version = "0.10.0" 979 | source = "registry+https://github.com/rust-lang/crates.io-index" 980 | checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" 981 | 982 | [[package]] 983 | name = "subtle" 984 | version = "2.4.1" 985 | source = "registry+https://github.com/rust-lang/crates.io-index" 986 | checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" 987 | 988 | [[package]] 989 | name = "syn" 990 | version = "1.0.107" 991 | source = "registry+https://github.com/rust-lang/crates.io-index" 992 | checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" 993 | dependencies = [ 994 | "proc-macro2", 995 | "quote", 996 | "unicode-ident", 997 | ] 998 | 999 | [[package]] 1000 | name = "synstructure" 1001 | version = "0.12.6" 1002 | source = "registry+https://github.com/rust-lang/crates.io-index" 1003 | checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" 1004 | dependencies = [ 1005 | "proc-macro2", 1006 | "quote", 1007 | "syn", 1008 | "unicode-xid", 1009 | ] 1010 | 1011 | [[package]] 1012 | name = "termcolor" 1013 | version = "1.1.3" 1014 | source = "registry+https://github.com/rust-lang/crates.io-index" 1015 | checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" 1016 | dependencies = [ 1017 | "winapi-util", 1018 | ] 1019 | 1020 | [[package]] 1021 | name = "thiserror" 1022 | version = "1.0.38" 1023 | source = "registry+https://github.com/rust-lang/crates.io-index" 1024 | checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" 1025 | dependencies = [ 1026 | "thiserror-impl", 1027 | ] 1028 | 1029 | [[package]] 1030 | name = "thiserror-impl" 1031 | version = "1.0.38" 1032 | source = "registry+https://github.com/rust-lang/crates.io-index" 1033 | checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" 1034 | dependencies = [ 1035 | "proc-macro2", 1036 | "quote", 1037 | "syn", 1038 | ] 1039 | 1040 | [[package]] 1041 | name = "twofish" 1042 | version = "0.7.1" 1043 | source = "registry+https://github.com/rust-lang/crates.io-index" 1044 | checksum = "a78e83a30223c757c3947cd144a31014ff04298d8719ae10d03c31c0448c8013" 1045 | dependencies = [ 1046 | "cipher", 1047 | ] 1048 | 1049 | [[package]] 1050 | name = "typenum" 1051 | version = "1.16.0" 1052 | source = "registry+https://github.com/rust-lang/crates.io-index" 1053 | checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" 1054 | 1055 | [[package]] 1056 | name = "unicode-ident" 1057 | version = "1.0.6" 1058 | source = "registry+https://github.com/rust-lang/crates.io-index" 1059 | checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" 1060 | 1061 | [[package]] 1062 | name = "unicode-width" 1063 | version = "0.1.10" 1064 | source = "registry+https://github.com/rust-lang/crates.io-index" 1065 | checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" 1066 | 1067 | [[package]] 1068 | name = "unicode-xid" 1069 | version = "0.2.4" 1070 | source = "registry+https://github.com/rust-lang/crates.io-index" 1071 | checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" 1072 | 1073 | [[package]] 1074 | name = "version_check" 1075 | version = "0.1.5" 1076 | source = "registry+https://github.com/rust-lang/crates.io-index" 1077 | checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" 1078 | 1079 | [[package]] 1080 | name = "version_check" 1081 | version = "0.9.4" 1082 | source = "registry+https://github.com/rust-lang/crates.io-index" 1083 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 1084 | 1085 | [[package]] 1086 | name = "wasi" 1087 | version = "0.9.0+wasi-snapshot-preview1" 1088 | source = "registry+https://github.com/rust-lang/crates.io-index" 1089 | checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" 1090 | 1091 | [[package]] 1092 | name = "wasi" 1093 | version = "0.11.0+wasi-snapshot-preview1" 1094 | source = "registry+https://github.com/rust-lang/crates.io-index" 1095 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 1096 | 1097 | [[package]] 1098 | name = "wasm-bindgen" 1099 | version = "0.2.83" 1100 | source = "registry+https://github.com/rust-lang/crates.io-index" 1101 | checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" 1102 | dependencies = [ 1103 | "cfg-if", 1104 | "wasm-bindgen-macro", 1105 | ] 1106 | 1107 | [[package]] 1108 | name = "wasm-bindgen-backend" 1109 | version = "0.2.83" 1110 | source = "registry+https://github.com/rust-lang/crates.io-index" 1111 | checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" 1112 | dependencies = [ 1113 | "bumpalo", 1114 | "log", 1115 | "once_cell", 1116 | "proc-macro2", 1117 | "quote", 1118 | "syn", 1119 | "wasm-bindgen-shared", 1120 | ] 1121 | 1122 | [[package]] 1123 | name = "wasm-bindgen-macro" 1124 | version = "0.2.83" 1125 | source = "registry+https://github.com/rust-lang/crates.io-index" 1126 | checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" 1127 | dependencies = [ 1128 | "quote", 1129 | "wasm-bindgen-macro-support", 1130 | ] 1131 | 1132 | [[package]] 1133 | name = "wasm-bindgen-macro-support" 1134 | version = "0.2.83" 1135 | source = "registry+https://github.com/rust-lang/crates.io-index" 1136 | checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" 1137 | dependencies = [ 1138 | "proc-macro2", 1139 | "quote", 1140 | "syn", 1141 | "wasm-bindgen-backend", 1142 | "wasm-bindgen-shared", 1143 | ] 1144 | 1145 | [[package]] 1146 | name = "wasm-bindgen-shared" 1147 | version = "0.2.83" 1148 | source = "registry+https://github.com/rust-lang/crates.io-index" 1149 | checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" 1150 | 1151 | [[package]] 1152 | name = "winapi" 1153 | version = "0.3.9" 1154 | source = "registry+https://github.com/rust-lang/crates.io-index" 1155 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1156 | dependencies = [ 1157 | "winapi-i686-pc-windows-gnu", 1158 | "winapi-x86_64-pc-windows-gnu", 1159 | ] 1160 | 1161 | [[package]] 1162 | name = "winapi-i686-pc-windows-gnu" 1163 | version = "0.4.0" 1164 | source = "registry+https://github.com/rust-lang/crates.io-index" 1165 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1166 | 1167 | [[package]] 1168 | name = "winapi-util" 1169 | version = "0.1.5" 1170 | source = "registry+https://github.com/rust-lang/crates.io-index" 1171 | checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" 1172 | dependencies = [ 1173 | "winapi", 1174 | ] 1175 | 1176 | [[package]] 1177 | name = "winapi-x86_64-pc-windows-gnu" 1178 | version = "0.4.0" 1179 | source = "registry+https://github.com/rust-lang/crates.io-index" 1180 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1181 | 1182 | [[package]] 1183 | name = "x25519-dalek" 1184 | version = "1.1.1" 1185 | source = "registry+https://github.com/rust-lang/crates.io-index" 1186 | checksum = "5a0c105152107e3b96f6a00a65e86ce82d9b125230e1c4302940eca58ff71f4f" 1187 | dependencies = [ 1188 | "curve25519-dalek", 1189 | "rand_core 0.5.1", 1190 | "zeroize", 1191 | ] 1192 | 1193 | [[package]] 1194 | name = "zeroize" 1195 | version = "1.5.7" 1196 | source = "registry+https://github.com/rust-lang/crates.io-index" 1197 | checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" 1198 | dependencies = [ 1199 | "zeroize_derive", 1200 | ] 1201 | 1202 | [[package]] 1203 | name = "zeroize_derive" 1204 | version = "1.3.3" 1205 | source = "registry+https://github.com/rust-lang/crates.io-index" 1206 | checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" 1207 | dependencies = [ 1208 | "proc-macro2", 1209 | "quote", 1210 | "syn", 1211 | "synstructure", 1212 | ] 1213 | -------------------------------------------------------------------------------- /create_keys_and_use/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "create_keys_and_use" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | anyhow = "1.0.68" 10 | pgp = "0.9.0" 11 | rand = "0.8.5" 12 | smallvec = "1.10.0" 13 | -------------------------------------------------------------------------------- /create_keys_and_use/README.md: -------------------------------------------------------------------------------- 1 | # Create and Use PGP Keys 2 | 3 | This example shows how to create and use PGP keys to encrypt and decrypt messages. 4 | 5 | When run, the program will: 6 | - Create a new PGP key pair and keep them in memory 7 | - Pass the public key to the `encrypt_message()` function, returning an encrypted string 8 | - Use the private key to decrypt the message and print it out 9 | 10 | The keys are converted to ASCII armored format, this is not strictly necessary for the encryption and decryption to work, but it is useful for many applications. -------------------------------------------------------------------------------- /create_keys_and_use/src/main.rs: -------------------------------------------------------------------------------- 1 | use anyhow::{Context, Result}; 2 | use pgp::{composed, composed::signed_key::*, crypto, types::SecretKeyTrait, Deserializable}; 3 | use rand::prelude::*; 4 | use smallvec::*; 5 | use std::io::Cursor; 6 | 7 | fn main() { 8 | println!("Example: Create Keys and Use Them"); 9 | 10 | println!("Creating key pair, this will take a few seconds..."); 11 | let key_pair = generate_key_pair().expect("Failed to generate key pair"); 12 | 13 | let msg = "This is a secret message"; 14 | println!("Secret message: {}", msg); 15 | let pub_key = key_pair 16 | .public_key 17 | .to_armored_string(None) 18 | .expect("Failed to convert public key to armored ASCII string"); 19 | println!("Public key: {}", pub_key); 20 | let encrypted = encrypt(msg, &pub_key).expect("Failed to encrypt message"); 21 | println!("Encrypted: {}", encrypted); 22 | 23 | let decrypted = decrypt(&encrypted, &key_pair.secret_key).expect("Failed to decrypt message"); 24 | println!("Decrypted: {}", decrypted); 25 | } 26 | 27 | #[derive(Debug)] 28 | pub struct KeyPair { 29 | pub secret_key: pgp::SignedSecretKey, 30 | pub public_key: pgp::SignedPublicKey, 31 | } 32 | 33 | pub fn generate_key_pair() -> Result { 34 | let mut key_params = composed::key::SecretKeyParamsBuilder::default(); 35 | key_params 36 | .key_type(composed::KeyType::Rsa(2048)) 37 | .can_create_certificates(false) 38 | .can_sign(true) 39 | .primary_user_id("Server ".into()) 40 | .preferred_symmetric_algorithms(smallvec![crypto::sym::SymmetricKeyAlgorithm::AES256]); 41 | 42 | let secret_key_params = key_params 43 | .build() 44 | .expect("Must be able to create secret key params"); 45 | 46 | let secret_key = secret_key_params 47 | .generate() 48 | .expect("Failed to generate a plain key."); 49 | 50 | let passwd_fn = || String::new(); 51 | let signed_secret_key = secret_key 52 | .sign(passwd_fn) 53 | .expect("Secret Key must be able to sign its own metadata"); 54 | 55 | let public_key = signed_secret_key.public_key(); 56 | let signed_public_key = public_key 57 | .sign(&signed_secret_key, passwd_fn) 58 | .expect("Public key must be able to sign its own metadata"); 59 | 60 | let key_pair = KeyPair { 61 | secret_key: signed_secret_key, 62 | public_key: signed_public_key, 63 | }; 64 | 65 | Ok(key_pair) 66 | } 67 | 68 | pub fn encrypt(msg: &str, pubkey_str: &str) -> Result { 69 | let (pubkey, _) = SignedPublicKey::from_string(pubkey_str)?; 70 | // Requires a file name as the first arg, in this case I pass "none", as it's not used 71 | let msg = composed::message::Message::new_literal("none", msg); 72 | 73 | let mut rng = StdRng::from_entropy(); 74 | let new_msg = msg.encrypt_to_keys( 75 | &mut rng, 76 | crypto::sym::SymmetricKeyAlgorithm::AES128, 77 | &[&pubkey], 78 | )?; 79 | Ok(new_msg.to_armored_string(None)?) 80 | } 81 | 82 | pub fn decrypt(armored: &str, seckey: &SignedSecretKey) -> Result { 83 | let buf = Cursor::new(armored); 84 | let (msg, _) = composed::message::Message::from_armor_single(buf) 85 | .context("Failed to convert &str to armored message")?; 86 | let (decryptor, _) = msg 87 | .decrypt(|| String::from(""), || String::from(""), &[seckey]) 88 | .context("Decrypting the message")?; 89 | 90 | for msg in decryptor { 91 | let bytes = msg?.get_content()?.unwrap(); 92 | let clear_text = String::from_utf8(bytes)?; 93 | return Ok(clear_text); 94 | } 95 | 96 | Err(anyhow::Error::msg("Failed to find message")) 97 | } 98 | -------------------------------------------------------------------------------- /keys_from_files/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "adler" 7 | version = "1.0.2" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 10 | 11 | [[package]] 12 | name = "aes" 13 | version = "0.8.2" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "433cfd6710c9986c576a25ca913c39d66a6474107b406f34f91d4a8923395241" 16 | dependencies = [ 17 | "cfg-if", 18 | "cipher", 19 | "cpufeatures", 20 | ] 21 | 22 | [[package]] 23 | name = "android_system_properties" 24 | version = "0.1.5" 25 | source = "registry+https://github.com/rust-lang/crates.io-index" 26 | checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" 27 | dependencies = [ 28 | "libc", 29 | ] 30 | 31 | [[package]] 32 | name = "anyhow" 33 | version = "1.0.66" 34 | source = "registry+https://github.com/rust-lang/crates.io-index" 35 | checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" 36 | 37 | [[package]] 38 | name = "autocfg" 39 | version = "1.1.0" 40 | source = "registry+https://github.com/rust-lang/crates.io-index" 41 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 42 | 43 | [[package]] 44 | name = "base64" 45 | version = "0.13.1" 46 | source = "registry+https://github.com/rust-lang/crates.io-index" 47 | checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" 48 | 49 | [[package]] 50 | name = "base64ct" 51 | version = "1.5.3" 52 | source = "registry+https://github.com/rust-lang/crates.io-index" 53 | checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" 54 | 55 | [[package]] 56 | name = "bitfield" 57 | version = "0.14.0" 58 | source = "registry+https://github.com/rust-lang/crates.io-index" 59 | checksum = "2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac" 60 | 61 | [[package]] 62 | name = "block-buffer" 63 | version = "0.9.0" 64 | source = "registry+https://github.com/rust-lang/crates.io-index" 65 | checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" 66 | dependencies = [ 67 | "generic-array", 68 | ] 69 | 70 | [[package]] 71 | name = "block-buffer" 72 | version = "0.10.3" 73 | source = "registry+https://github.com/rust-lang/crates.io-index" 74 | checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" 75 | dependencies = [ 76 | "generic-array", 77 | ] 78 | 79 | [[package]] 80 | name = "block-padding" 81 | version = "0.3.2" 82 | source = "registry+https://github.com/rust-lang/crates.io-index" 83 | checksum = "0a90ec2df9600c28a01c56c4784c9207a96d2451833aeceb8cc97e4c9548bb78" 84 | dependencies = [ 85 | "generic-array", 86 | ] 87 | 88 | [[package]] 89 | name = "blowfish" 90 | version = "0.9.1" 91 | source = "registry+https://github.com/rust-lang/crates.io-index" 92 | checksum = "e412e2cd0f2b2d93e02543ceae7917b3c70331573df19ee046bcbc35e45e87d7" 93 | dependencies = [ 94 | "byteorder", 95 | "cipher", 96 | ] 97 | 98 | [[package]] 99 | name = "buf_redux" 100 | version = "0.8.4" 101 | source = "registry+https://github.com/rust-lang/crates.io-index" 102 | checksum = "b953a6887648bb07a535631f2bc00fbdb2a2216f135552cb3f534ed136b9c07f" 103 | dependencies = [ 104 | "memchr", 105 | "safemem", 106 | ] 107 | 108 | [[package]] 109 | name = "bumpalo" 110 | version = "3.11.1" 111 | source = "registry+https://github.com/rust-lang/crates.io-index" 112 | checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" 113 | 114 | [[package]] 115 | name = "byteorder" 116 | version = "1.4.3" 117 | source = "registry+https://github.com/rust-lang/crates.io-index" 118 | checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" 119 | 120 | [[package]] 121 | name = "cast5" 122 | version = "0.11.1" 123 | source = "registry+https://github.com/rust-lang/crates.io-index" 124 | checksum = "26b07d673db1ccf000e90f54b819db9e75a8348d6eb056e9b8ab53231b7a9911" 125 | dependencies = [ 126 | "cipher", 127 | ] 128 | 129 | [[package]] 130 | name = "cc" 131 | version = "1.0.76" 132 | source = "registry+https://github.com/rust-lang/crates.io-index" 133 | checksum = "76a284da2e6fe2092f2353e51713435363112dfd60030e22add80be333fb928f" 134 | 135 | [[package]] 136 | name = "cfb-mode" 137 | version = "0.8.2" 138 | source = "registry+https://github.com/rust-lang/crates.io-index" 139 | checksum = "738b8d467867f80a71351933f70461f5b56f24d5c93e0cf216e59229c968d330" 140 | dependencies = [ 141 | "cipher", 142 | ] 143 | 144 | [[package]] 145 | name = "cfg-if" 146 | version = "1.0.0" 147 | source = "registry+https://github.com/rust-lang/crates.io-index" 148 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 149 | 150 | [[package]] 151 | name = "chrono" 152 | version = "0.4.23" 153 | source = "registry+https://github.com/rust-lang/crates.io-index" 154 | checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" 155 | dependencies = [ 156 | "iana-time-zone", 157 | "num-integer", 158 | "num-traits", 159 | "winapi", 160 | ] 161 | 162 | [[package]] 163 | name = "cipher" 164 | version = "0.4.3" 165 | source = "registry+https://github.com/rust-lang/crates.io-index" 166 | checksum = "d1873270f8f7942c191139cb8a40fd228da6c3fd2fc376d7e92d47aa14aeb59e" 167 | dependencies = [ 168 | "crypto-common", 169 | "inout", 170 | ] 171 | 172 | [[package]] 173 | name = "codespan-reporting" 174 | version = "0.11.1" 175 | source = "registry+https://github.com/rust-lang/crates.io-index" 176 | checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" 177 | dependencies = [ 178 | "termcolor", 179 | "unicode-width", 180 | ] 181 | 182 | [[package]] 183 | name = "const-oid" 184 | version = "0.9.1" 185 | source = "registry+https://github.com/rust-lang/crates.io-index" 186 | checksum = "cec318a675afcb6a1ea1d4340e2d377e56e47c266f28043ceccbf4412ddfdd3b" 187 | 188 | [[package]] 189 | name = "core-foundation-sys" 190 | version = "0.8.3" 191 | source = "registry+https://github.com/rust-lang/crates.io-index" 192 | checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" 193 | 194 | [[package]] 195 | name = "cpufeatures" 196 | version = "0.2.5" 197 | source = "registry+https://github.com/rust-lang/crates.io-index" 198 | checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" 199 | dependencies = [ 200 | "libc", 201 | ] 202 | 203 | [[package]] 204 | name = "crc24" 205 | version = "0.1.6" 206 | source = "registry+https://github.com/rust-lang/crates.io-index" 207 | checksum = "fd121741cf3eb82c08dd3023eb55bf2665e5f60ec20f89760cf836ae4562e6a0" 208 | 209 | [[package]] 210 | name = "crc32fast" 211 | version = "1.3.2" 212 | source = "registry+https://github.com/rust-lang/crates.io-index" 213 | checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" 214 | dependencies = [ 215 | "cfg-if", 216 | ] 217 | 218 | [[package]] 219 | name = "crypto-common" 220 | version = "0.1.6" 221 | source = "registry+https://github.com/rust-lang/crates.io-index" 222 | checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" 223 | dependencies = [ 224 | "generic-array", 225 | "typenum", 226 | ] 227 | 228 | [[package]] 229 | name = "curve25519-dalek" 230 | version = "3.2.0" 231 | source = "registry+https://github.com/rust-lang/crates.io-index" 232 | checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" 233 | dependencies = [ 234 | "byteorder", 235 | "digest 0.9.0", 236 | "rand_core 0.5.1", 237 | "subtle", 238 | "zeroize", 239 | ] 240 | 241 | [[package]] 242 | name = "cxx" 243 | version = "1.0.81" 244 | source = "registry+https://github.com/rust-lang/crates.io-index" 245 | checksum = "97abf9f0eca9e52b7f81b945524e76710e6cb2366aead23b7d4fbf72e281f888" 246 | dependencies = [ 247 | "cc", 248 | "cxxbridge-flags", 249 | "cxxbridge-macro", 250 | "link-cplusplus", 251 | ] 252 | 253 | [[package]] 254 | name = "cxx-build" 255 | version = "1.0.81" 256 | source = "registry+https://github.com/rust-lang/crates.io-index" 257 | checksum = "7cc32cc5fea1d894b77d269ddb9f192110069a8a9c1f1d441195fba90553dea3" 258 | dependencies = [ 259 | "cc", 260 | "codespan-reporting", 261 | "once_cell", 262 | "proc-macro2", 263 | "quote", 264 | "scratch", 265 | "syn", 266 | ] 267 | 268 | [[package]] 269 | name = "cxxbridge-flags" 270 | version = "1.0.81" 271 | source = "registry+https://github.com/rust-lang/crates.io-index" 272 | checksum = "8ca220e4794c934dc6b1207c3b42856ad4c302f2df1712e9f8d2eec5afaacf1f" 273 | 274 | [[package]] 275 | name = "cxxbridge-macro" 276 | version = "1.0.81" 277 | source = "registry+https://github.com/rust-lang/crates.io-index" 278 | checksum = "b846f081361125bfc8dc9d3940c84e1fd83ba54bbca7b17cd29483c828be0704" 279 | dependencies = [ 280 | "proc-macro2", 281 | "quote", 282 | "syn", 283 | ] 284 | 285 | [[package]] 286 | name = "darling" 287 | version = "0.14.2" 288 | source = "registry+https://github.com/rust-lang/crates.io-index" 289 | checksum = "b0dd3cd20dc6b5a876612a6e5accfe7f3dd883db6d07acfbf14c128f61550dfa" 290 | dependencies = [ 291 | "darling_core", 292 | "darling_macro", 293 | ] 294 | 295 | [[package]] 296 | name = "darling_core" 297 | version = "0.14.2" 298 | source = "registry+https://github.com/rust-lang/crates.io-index" 299 | checksum = "a784d2ccaf7c98501746bf0be29b2022ba41fd62a2e622af997a03e9f972859f" 300 | dependencies = [ 301 | "fnv", 302 | "ident_case", 303 | "proc-macro2", 304 | "quote", 305 | "strsim", 306 | "syn", 307 | ] 308 | 309 | [[package]] 310 | name = "darling_macro" 311 | version = "0.14.2" 312 | source = "registry+https://github.com/rust-lang/crates.io-index" 313 | checksum = "7618812407e9402654622dd402b0a89dff9ba93badd6540781526117b92aab7e" 314 | dependencies = [ 315 | "darling_core", 316 | "quote", 317 | "syn", 318 | ] 319 | 320 | [[package]] 321 | name = "der" 322 | version = "0.6.0" 323 | source = "registry+https://github.com/rust-lang/crates.io-index" 324 | checksum = "13dd2ae565c0a381dde7fade45fce95984c568bdcb4700a4fdbe3175e0380b2f" 325 | dependencies = [ 326 | "const-oid", 327 | "pem-rfc7468", 328 | "zeroize", 329 | ] 330 | 331 | [[package]] 332 | name = "derive_builder" 333 | version = "0.11.2" 334 | source = "registry+https://github.com/rust-lang/crates.io-index" 335 | checksum = "d07adf7be193b71cc36b193d0f5fe60b918a3a9db4dad0449f57bcfd519704a3" 336 | dependencies = [ 337 | "derive_builder_macro", 338 | ] 339 | 340 | [[package]] 341 | name = "derive_builder_core" 342 | version = "0.11.2" 343 | source = "registry+https://github.com/rust-lang/crates.io-index" 344 | checksum = "1f91d4cfa921f1c05904dc3c57b4a32c38aed3340cce209f3a6fd1478babafc4" 345 | dependencies = [ 346 | "darling", 347 | "proc-macro2", 348 | "quote", 349 | "syn", 350 | ] 351 | 352 | [[package]] 353 | name = "derive_builder_macro" 354 | version = "0.11.2" 355 | source = "registry+https://github.com/rust-lang/crates.io-index" 356 | checksum = "8f0314b72bed045f3a68671b3c86328386762c93f82d98c65c3cb5e5f573dd68" 357 | dependencies = [ 358 | "derive_builder_core", 359 | "syn", 360 | ] 361 | 362 | [[package]] 363 | name = "des" 364 | version = "0.8.1" 365 | source = "registry+https://github.com/rust-lang/crates.io-index" 366 | checksum = "ffdd80ce8ce993de27e9f063a444a4d53ce8e8db4c1f00cc03af5ad5a9867a1e" 367 | dependencies = [ 368 | "cipher", 369 | ] 370 | 371 | [[package]] 372 | name = "digest" 373 | version = "0.9.0" 374 | source = "registry+https://github.com/rust-lang/crates.io-index" 375 | checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" 376 | dependencies = [ 377 | "generic-array", 378 | ] 379 | 380 | [[package]] 381 | name = "digest" 382 | version = "0.10.6" 383 | source = "registry+https://github.com/rust-lang/crates.io-index" 384 | checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" 385 | dependencies = [ 386 | "block-buffer 0.10.3", 387 | "const-oid", 388 | "crypto-common", 389 | ] 390 | 391 | [[package]] 392 | name = "ed25519" 393 | version = "1.5.2" 394 | source = "registry+https://github.com/rust-lang/crates.io-index" 395 | checksum = "1e9c280362032ea4203659fc489832d0204ef09f247a0506f170dafcac08c369" 396 | dependencies = [ 397 | "signature", 398 | ] 399 | 400 | [[package]] 401 | name = "ed25519-dalek" 402 | version = "1.0.1" 403 | source = "registry+https://github.com/rust-lang/crates.io-index" 404 | checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" 405 | dependencies = [ 406 | "curve25519-dalek", 407 | "ed25519", 408 | "rand 0.7.3", 409 | "serde", 410 | "sha2 0.9.9", 411 | "zeroize", 412 | ] 413 | 414 | [[package]] 415 | name = "flate2" 416 | version = "1.0.24" 417 | source = "registry+https://github.com/rust-lang/crates.io-index" 418 | checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" 419 | dependencies = [ 420 | "crc32fast", 421 | "miniz_oxide", 422 | ] 423 | 424 | [[package]] 425 | name = "fnv" 426 | version = "1.0.7" 427 | source = "registry+https://github.com/rust-lang/crates.io-index" 428 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 429 | 430 | [[package]] 431 | name = "generic-array" 432 | version = "0.14.6" 433 | source = "registry+https://github.com/rust-lang/crates.io-index" 434 | checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" 435 | dependencies = [ 436 | "typenum", 437 | "version_check 0.9.4", 438 | ] 439 | 440 | [[package]] 441 | name = "getrandom" 442 | version = "0.1.16" 443 | source = "registry+https://github.com/rust-lang/crates.io-index" 444 | checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" 445 | dependencies = [ 446 | "cfg-if", 447 | "libc", 448 | "wasi 0.9.0+wasi-snapshot-preview1", 449 | ] 450 | 451 | [[package]] 452 | name = "getrandom" 453 | version = "0.2.8" 454 | source = "registry+https://github.com/rust-lang/crates.io-index" 455 | checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" 456 | dependencies = [ 457 | "cfg-if", 458 | "libc", 459 | "wasi 0.11.0+wasi-snapshot-preview1", 460 | ] 461 | 462 | [[package]] 463 | name = "hex" 464 | version = "0.4.3" 465 | source = "registry+https://github.com/rust-lang/crates.io-index" 466 | checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" 467 | 468 | [[package]] 469 | name = "iana-time-zone" 470 | version = "0.1.53" 471 | source = "registry+https://github.com/rust-lang/crates.io-index" 472 | checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" 473 | dependencies = [ 474 | "android_system_properties", 475 | "core-foundation-sys", 476 | "iana-time-zone-haiku", 477 | "js-sys", 478 | "wasm-bindgen", 479 | "winapi", 480 | ] 481 | 482 | [[package]] 483 | name = "iana-time-zone-haiku" 484 | version = "0.1.1" 485 | source = "registry+https://github.com/rust-lang/crates.io-index" 486 | checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" 487 | dependencies = [ 488 | "cxx", 489 | "cxx-build", 490 | ] 491 | 492 | [[package]] 493 | name = "ident_case" 494 | version = "1.0.1" 495 | source = "registry+https://github.com/rust-lang/crates.io-index" 496 | checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" 497 | 498 | [[package]] 499 | name = "inout" 500 | version = "0.1.3" 501 | source = "registry+https://github.com/rust-lang/crates.io-index" 502 | checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" 503 | dependencies = [ 504 | "generic-array", 505 | ] 506 | 507 | [[package]] 508 | name = "js-sys" 509 | version = "0.3.60" 510 | source = "registry+https://github.com/rust-lang/crates.io-index" 511 | checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" 512 | dependencies = [ 513 | "wasm-bindgen", 514 | ] 515 | 516 | [[package]] 517 | name = "keccak" 518 | version = "0.1.3" 519 | source = "registry+https://github.com/rust-lang/crates.io-index" 520 | checksum = "3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768" 521 | dependencies = [ 522 | "cpufeatures", 523 | ] 524 | 525 | [[package]] 526 | name = "lazy_static" 527 | version = "1.4.0" 528 | source = "registry+https://github.com/rust-lang/crates.io-index" 529 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 530 | dependencies = [ 531 | "spin", 532 | ] 533 | 534 | [[package]] 535 | name = "libc" 536 | version = "0.2.137" 537 | source = "registry+https://github.com/rust-lang/crates.io-index" 538 | checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" 539 | 540 | [[package]] 541 | name = "libm" 542 | version = "0.2.6" 543 | source = "registry+https://github.com/rust-lang/crates.io-index" 544 | checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" 545 | 546 | [[package]] 547 | name = "link-cplusplus" 548 | version = "1.0.7" 549 | source = "registry+https://github.com/rust-lang/crates.io-index" 550 | checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" 551 | dependencies = [ 552 | "cc", 553 | ] 554 | 555 | [[package]] 556 | name = "log" 557 | version = "0.4.17" 558 | source = "registry+https://github.com/rust-lang/crates.io-index" 559 | checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" 560 | dependencies = [ 561 | "cfg-if", 562 | ] 563 | 564 | [[package]] 565 | name = "md-5" 566 | version = "0.10.5" 567 | source = "registry+https://github.com/rust-lang/crates.io-index" 568 | checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" 569 | dependencies = [ 570 | "digest 0.10.6", 571 | ] 572 | 573 | [[package]] 574 | name = "memchr" 575 | version = "2.5.0" 576 | source = "registry+https://github.com/rust-lang/crates.io-index" 577 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" 578 | 579 | [[package]] 580 | name = "miniz_oxide" 581 | version = "0.5.4" 582 | source = "registry+https://github.com/rust-lang/crates.io-index" 583 | checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34" 584 | dependencies = [ 585 | "adler", 586 | ] 587 | 588 | [[package]] 589 | name = "nom" 590 | version = "4.2.3" 591 | source = "registry+https://github.com/rust-lang/crates.io-index" 592 | checksum = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6" 593 | dependencies = [ 594 | "memchr", 595 | "version_check 0.1.5", 596 | ] 597 | 598 | [[package]] 599 | name = "num-bigint-dig" 600 | version = "0.8.1" 601 | source = "registry+https://github.com/rust-lang/crates.io-index" 602 | checksum = "566d173b2f9406afbc5510a90925d5a2cd80cae4605631f1212303df265de011" 603 | dependencies = [ 604 | "byteorder", 605 | "lazy_static", 606 | "libm", 607 | "num-integer", 608 | "num-iter", 609 | "num-traits", 610 | "rand 0.8.5", 611 | "serde", 612 | "smallvec", 613 | "zeroize", 614 | ] 615 | 616 | [[package]] 617 | name = "num-derive" 618 | version = "0.3.3" 619 | source = "registry+https://github.com/rust-lang/crates.io-index" 620 | checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" 621 | dependencies = [ 622 | "proc-macro2", 623 | "quote", 624 | "syn", 625 | ] 626 | 627 | [[package]] 628 | name = "num-integer" 629 | version = "0.1.45" 630 | source = "registry+https://github.com/rust-lang/crates.io-index" 631 | checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" 632 | dependencies = [ 633 | "autocfg", 634 | "num-traits", 635 | ] 636 | 637 | [[package]] 638 | name = "num-iter" 639 | version = "0.1.43" 640 | source = "registry+https://github.com/rust-lang/crates.io-index" 641 | checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" 642 | dependencies = [ 643 | "autocfg", 644 | "num-integer", 645 | "num-traits", 646 | ] 647 | 648 | [[package]] 649 | name = "num-traits" 650 | version = "0.2.15" 651 | source = "registry+https://github.com/rust-lang/crates.io-index" 652 | checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" 653 | dependencies = [ 654 | "autocfg", 655 | "libm", 656 | ] 657 | 658 | [[package]] 659 | name = "once_cell" 660 | version = "1.16.0" 661 | source = "registry+https://github.com/rust-lang/crates.io-index" 662 | checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" 663 | 664 | [[package]] 665 | name = "opaque-debug" 666 | version = "0.3.0" 667 | source = "registry+https://github.com/rust-lang/crates.io-index" 668 | checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" 669 | 670 | [[package]] 671 | name = "pem-rfc7468" 672 | version = "0.6.0" 673 | source = "registry+https://github.com/rust-lang/crates.io-index" 674 | checksum = "24d159833a9105500e0398934e205e0773f0b27529557134ecfc51c27646adac" 675 | dependencies = [ 676 | "base64ct", 677 | ] 678 | 679 | [[package]] 680 | name = "pgp" 681 | version = "0.9.0" 682 | source = "registry+https://github.com/rust-lang/crates.io-index" 683 | checksum = "991e3f098483f52c454c7cb16720adc010c2966a8845d3c34aad589cb86d3196" 684 | dependencies = [ 685 | "aes", 686 | "base64", 687 | "bitfield", 688 | "block-padding", 689 | "blowfish", 690 | "buf_redux", 691 | "byteorder", 692 | "cast5", 693 | "cfb-mode", 694 | "chrono", 695 | "cipher", 696 | "crc24", 697 | "derive_builder", 698 | "des", 699 | "digest 0.10.6", 700 | "ed25519-dalek", 701 | "flate2", 702 | "generic-array", 703 | "hex", 704 | "log", 705 | "md-5", 706 | "nom", 707 | "num-bigint-dig", 708 | "num-derive", 709 | "num-traits", 710 | "rand 0.8.5", 711 | "ripemd", 712 | "rsa", 713 | "sha1", 714 | "sha2 0.10.6", 715 | "sha3", 716 | "signature", 717 | "smallvec", 718 | "thiserror", 719 | "twofish", 720 | "x25519-dalek", 721 | "zeroize", 722 | ] 723 | 724 | [[package]] 725 | name = "pgp_example" 726 | version = "0.1.0" 727 | dependencies = [ 728 | "anyhow", 729 | "pgp", 730 | "rand 0.8.5", 731 | ] 732 | 733 | [[package]] 734 | name = "pkcs1" 735 | version = "0.4.1" 736 | source = "registry+https://github.com/rust-lang/crates.io-index" 737 | checksum = "eff33bdbdfc54cc98a2eca766ebdec3e1b8fb7387523d5c9c9a2891da856f719" 738 | dependencies = [ 739 | "der", 740 | "pkcs8", 741 | "spki", 742 | "zeroize", 743 | ] 744 | 745 | [[package]] 746 | name = "pkcs8" 747 | version = "0.9.0" 748 | source = "registry+https://github.com/rust-lang/crates.io-index" 749 | checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" 750 | dependencies = [ 751 | "der", 752 | "spki", 753 | ] 754 | 755 | [[package]] 756 | name = "ppv-lite86" 757 | version = "0.2.17" 758 | source = "registry+https://github.com/rust-lang/crates.io-index" 759 | checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" 760 | 761 | [[package]] 762 | name = "proc-macro2" 763 | version = "1.0.47" 764 | source = "registry+https://github.com/rust-lang/crates.io-index" 765 | checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" 766 | dependencies = [ 767 | "unicode-ident", 768 | ] 769 | 770 | [[package]] 771 | name = "quote" 772 | version = "1.0.21" 773 | source = "registry+https://github.com/rust-lang/crates.io-index" 774 | checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" 775 | dependencies = [ 776 | "proc-macro2", 777 | ] 778 | 779 | [[package]] 780 | name = "rand" 781 | version = "0.7.3" 782 | source = "registry+https://github.com/rust-lang/crates.io-index" 783 | checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" 784 | dependencies = [ 785 | "getrandom 0.1.16", 786 | "libc", 787 | "rand_chacha 0.2.2", 788 | "rand_core 0.5.1", 789 | "rand_hc", 790 | ] 791 | 792 | [[package]] 793 | name = "rand" 794 | version = "0.8.5" 795 | source = "registry+https://github.com/rust-lang/crates.io-index" 796 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 797 | dependencies = [ 798 | "libc", 799 | "rand_chacha 0.3.1", 800 | "rand_core 0.6.4", 801 | ] 802 | 803 | [[package]] 804 | name = "rand_chacha" 805 | version = "0.2.2" 806 | source = "registry+https://github.com/rust-lang/crates.io-index" 807 | checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" 808 | dependencies = [ 809 | "ppv-lite86", 810 | "rand_core 0.5.1", 811 | ] 812 | 813 | [[package]] 814 | name = "rand_chacha" 815 | version = "0.3.1" 816 | source = "registry+https://github.com/rust-lang/crates.io-index" 817 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 818 | dependencies = [ 819 | "ppv-lite86", 820 | "rand_core 0.6.4", 821 | ] 822 | 823 | [[package]] 824 | name = "rand_core" 825 | version = "0.5.1" 826 | source = "registry+https://github.com/rust-lang/crates.io-index" 827 | checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" 828 | dependencies = [ 829 | "getrandom 0.1.16", 830 | ] 831 | 832 | [[package]] 833 | name = "rand_core" 834 | version = "0.6.4" 835 | source = "registry+https://github.com/rust-lang/crates.io-index" 836 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 837 | dependencies = [ 838 | "getrandom 0.2.8", 839 | ] 840 | 841 | [[package]] 842 | name = "rand_hc" 843 | version = "0.2.0" 844 | source = "registry+https://github.com/rust-lang/crates.io-index" 845 | checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" 846 | dependencies = [ 847 | "rand_core 0.5.1", 848 | ] 849 | 850 | [[package]] 851 | name = "ripemd" 852 | version = "0.1.3" 853 | source = "registry+https://github.com/rust-lang/crates.io-index" 854 | checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" 855 | dependencies = [ 856 | "digest 0.10.6", 857 | ] 858 | 859 | [[package]] 860 | name = "rsa" 861 | version = "0.7.2" 862 | source = "registry+https://github.com/rust-lang/crates.io-index" 863 | checksum = "094052d5470cbcef561cb848a7209968c9f12dfa6d668f4bca048ac5de51099c" 864 | dependencies = [ 865 | "byteorder", 866 | "digest 0.10.6", 867 | "num-bigint-dig", 868 | "num-integer", 869 | "num-iter", 870 | "num-traits", 871 | "pkcs1", 872 | "pkcs8", 873 | "rand_core 0.6.4", 874 | "signature", 875 | "smallvec", 876 | "subtle", 877 | "zeroize", 878 | ] 879 | 880 | [[package]] 881 | name = "safemem" 882 | version = "0.3.3" 883 | source = "registry+https://github.com/rust-lang/crates.io-index" 884 | checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" 885 | 886 | [[package]] 887 | name = "scratch" 888 | version = "1.0.2" 889 | source = "registry+https://github.com/rust-lang/crates.io-index" 890 | checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" 891 | 892 | [[package]] 893 | name = "serde" 894 | version = "1.0.147" 895 | source = "registry+https://github.com/rust-lang/crates.io-index" 896 | checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" 897 | 898 | [[package]] 899 | name = "sha1" 900 | version = "0.10.5" 901 | source = "registry+https://github.com/rust-lang/crates.io-index" 902 | checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" 903 | dependencies = [ 904 | "cfg-if", 905 | "cpufeatures", 906 | "digest 0.10.6", 907 | ] 908 | 909 | [[package]] 910 | name = "sha2" 911 | version = "0.9.9" 912 | source = "registry+https://github.com/rust-lang/crates.io-index" 913 | checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" 914 | dependencies = [ 915 | "block-buffer 0.9.0", 916 | "cfg-if", 917 | "cpufeatures", 918 | "digest 0.9.0", 919 | "opaque-debug", 920 | ] 921 | 922 | [[package]] 923 | name = "sha2" 924 | version = "0.10.6" 925 | source = "registry+https://github.com/rust-lang/crates.io-index" 926 | checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" 927 | dependencies = [ 928 | "cfg-if", 929 | "cpufeatures", 930 | "digest 0.10.6", 931 | ] 932 | 933 | [[package]] 934 | name = "sha3" 935 | version = "0.10.6" 936 | source = "registry+https://github.com/rust-lang/crates.io-index" 937 | checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" 938 | dependencies = [ 939 | "digest 0.10.6", 940 | "keccak", 941 | ] 942 | 943 | [[package]] 944 | name = "signature" 945 | version = "1.6.4" 946 | source = "registry+https://github.com/rust-lang/crates.io-index" 947 | checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" 948 | dependencies = [ 949 | "digest 0.10.6", 950 | "rand_core 0.6.4", 951 | ] 952 | 953 | [[package]] 954 | name = "smallvec" 955 | version = "1.10.0" 956 | source = "registry+https://github.com/rust-lang/crates.io-index" 957 | checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" 958 | 959 | [[package]] 960 | name = "spin" 961 | version = "0.5.2" 962 | source = "registry+https://github.com/rust-lang/crates.io-index" 963 | checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" 964 | 965 | [[package]] 966 | name = "spki" 967 | version = "0.6.0" 968 | source = "registry+https://github.com/rust-lang/crates.io-index" 969 | checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" 970 | dependencies = [ 971 | "base64ct", 972 | "der", 973 | ] 974 | 975 | [[package]] 976 | name = "strsim" 977 | version = "0.10.0" 978 | source = "registry+https://github.com/rust-lang/crates.io-index" 979 | checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" 980 | 981 | [[package]] 982 | name = "subtle" 983 | version = "2.4.1" 984 | source = "registry+https://github.com/rust-lang/crates.io-index" 985 | checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" 986 | 987 | [[package]] 988 | name = "syn" 989 | version = "1.0.103" 990 | source = "registry+https://github.com/rust-lang/crates.io-index" 991 | checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" 992 | dependencies = [ 993 | "proc-macro2", 994 | "quote", 995 | "unicode-ident", 996 | ] 997 | 998 | [[package]] 999 | name = "synstructure" 1000 | version = "0.12.6" 1001 | source = "registry+https://github.com/rust-lang/crates.io-index" 1002 | checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" 1003 | dependencies = [ 1004 | "proc-macro2", 1005 | "quote", 1006 | "syn", 1007 | "unicode-xid", 1008 | ] 1009 | 1010 | [[package]] 1011 | name = "termcolor" 1012 | version = "1.1.3" 1013 | source = "registry+https://github.com/rust-lang/crates.io-index" 1014 | checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" 1015 | dependencies = [ 1016 | "winapi-util", 1017 | ] 1018 | 1019 | [[package]] 1020 | name = "thiserror" 1021 | version = "1.0.37" 1022 | source = "registry+https://github.com/rust-lang/crates.io-index" 1023 | checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" 1024 | dependencies = [ 1025 | "thiserror-impl", 1026 | ] 1027 | 1028 | [[package]] 1029 | name = "thiserror-impl" 1030 | version = "1.0.37" 1031 | source = "registry+https://github.com/rust-lang/crates.io-index" 1032 | checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" 1033 | dependencies = [ 1034 | "proc-macro2", 1035 | "quote", 1036 | "syn", 1037 | ] 1038 | 1039 | [[package]] 1040 | name = "twofish" 1041 | version = "0.7.1" 1042 | source = "registry+https://github.com/rust-lang/crates.io-index" 1043 | checksum = "a78e83a30223c757c3947cd144a31014ff04298d8719ae10d03c31c0448c8013" 1044 | dependencies = [ 1045 | "cipher", 1046 | ] 1047 | 1048 | [[package]] 1049 | name = "typenum" 1050 | version = "1.15.0" 1051 | source = "registry+https://github.com/rust-lang/crates.io-index" 1052 | checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" 1053 | 1054 | [[package]] 1055 | name = "unicode-ident" 1056 | version = "1.0.5" 1057 | source = "registry+https://github.com/rust-lang/crates.io-index" 1058 | checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" 1059 | 1060 | [[package]] 1061 | name = "unicode-width" 1062 | version = "0.1.10" 1063 | source = "registry+https://github.com/rust-lang/crates.io-index" 1064 | checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" 1065 | 1066 | [[package]] 1067 | name = "unicode-xid" 1068 | version = "0.2.4" 1069 | source = "registry+https://github.com/rust-lang/crates.io-index" 1070 | checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" 1071 | 1072 | [[package]] 1073 | name = "version_check" 1074 | version = "0.1.5" 1075 | source = "registry+https://github.com/rust-lang/crates.io-index" 1076 | checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" 1077 | 1078 | [[package]] 1079 | name = "version_check" 1080 | version = "0.9.4" 1081 | source = "registry+https://github.com/rust-lang/crates.io-index" 1082 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 1083 | 1084 | [[package]] 1085 | name = "wasi" 1086 | version = "0.9.0+wasi-snapshot-preview1" 1087 | source = "registry+https://github.com/rust-lang/crates.io-index" 1088 | checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" 1089 | 1090 | [[package]] 1091 | name = "wasi" 1092 | version = "0.11.0+wasi-snapshot-preview1" 1093 | source = "registry+https://github.com/rust-lang/crates.io-index" 1094 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 1095 | 1096 | [[package]] 1097 | name = "wasm-bindgen" 1098 | version = "0.2.83" 1099 | source = "registry+https://github.com/rust-lang/crates.io-index" 1100 | checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" 1101 | dependencies = [ 1102 | "cfg-if", 1103 | "wasm-bindgen-macro", 1104 | ] 1105 | 1106 | [[package]] 1107 | name = "wasm-bindgen-backend" 1108 | version = "0.2.83" 1109 | source = "registry+https://github.com/rust-lang/crates.io-index" 1110 | checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" 1111 | dependencies = [ 1112 | "bumpalo", 1113 | "log", 1114 | "once_cell", 1115 | "proc-macro2", 1116 | "quote", 1117 | "syn", 1118 | "wasm-bindgen-shared", 1119 | ] 1120 | 1121 | [[package]] 1122 | name = "wasm-bindgen-macro" 1123 | version = "0.2.83" 1124 | source = "registry+https://github.com/rust-lang/crates.io-index" 1125 | checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" 1126 | dependencies = [ 1127 | "quote", 1128 | "wasm-bindgen-macro-support", 1129 | ] 1130 | 1131 | [[package]] 1132 | name = "wasm-bindgen-macro-support" 1133 | version = "0.2.83" 1134 | source = "registry+https://github.com/rust-lang/crates.io-index" 1135 | checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" 1136 | dependencies = [ 1137 | "proc-macro2", 1138 | "quote", 1139 | "syn", 1140 | "wasm-bindgen-backend", 1141 | "wasm-bindgen-shared", 1142 | ] 1143 | 1144 | [[package]] 1145 | name = "wasm-bindgen-shared" 1146 | version = "0.2.83" 1147 | source = "registry+https://github.com/rust-lang/crates.io-index" 1148 | checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" 1149 | 1150 | [[package]] 1151 | name = "winapi" 1152 | version = "0.3.9" 1153 | source = "registry+https://github.com/rust-lang/crates.io-index" 1154 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1155 | dependencies = [ 1156 | "winapi-i686-pc-windows-gnu", 1157 | "winapi-x86_64-pc-windows-gnu", 1158 | ] 1159 | 1160 | [[package]] 1161 | name = "winapi-i686-pc-windows-gnu" 1162 | version = "0.4.0" 1163 | source = "registry+https://github.com/rust-lang/crates.io-index" 1164 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1165 | 1166 | [[package]] 1167 | name = "winapi-util" 1168 | version = "0.1.5" 1169 | source = "registry+https://github.com/rust-lang/crates.io-index" 1170 | checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" 1171 | dependencies = [ 1172 | "winapi", 1173 | ] 1174 | 1175 | [[package]] 1176 | name = "winapi-x86_64-pc-windows-gnu" 1177 | version = "0.4.0" 1178 | source = "registry+https://github.com/rust-lang/crates.io-index" 1179 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1180 | 1181 | [[package]] 1182 | name = "x25519-dalek" 1183 | version = "1.1.1" 1184 | source = "registry+https://github.com/rust-lang/crates.io-index" 1185 | checksum = "5a0c105152107e3b96f6a00a65e86ce82d9b125230e1c4302940eca58ff71f4f" 1186 | dependencies = [ 1187 | "curve25519-dalek", 1188 | "rand_core 0.5.1", 1189 | "zeroize", 1190 | ] 1191 | 1192 | [[package]] 1193 | name = "zeroize" 1194 | version = "1.5.7" 1195 | source = "registry+https://github.com/rust-lang/crates.io-index" 1196 | checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" 1197 | dependencies = [ 1198 | "zeroize_derive", 1199 | ] 1200 | 1201 | [[package]] 1202 | name = "zeroize_derive" 1203 | version = "1.3.2" 1204 | source = "registry+https://github.com/rust-lang/crates.io-index" 1205 | checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" 1206 | dependencies = [ 1207 | "proc-macro2", 1208 | "quote", 1209 | "syn", 1210 | "synstructure", 1211 | ] 1212 | -------------------------------------------------------------------------------- /keys_from_files/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "keys_from_file" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | anyhow = "1.0.66" 10 | pgp = "0.9.0" 11 | rand = "0.8.5" 12 | -------------------------------------------------------------------------------- /keys_from_files/README.md: -------------------------------------------------------------------------------- 1 | # Using Existing Keys 2 | 3 | This example shows how to use existing keys to encrypt and decrypt messages. 4 | 5 | When run, the program will: 6 | - Encrypt a string, and save the encrypted string to a file. 7 | - Read in that file, and decrypt the message it contains. 8 | - Print both strings for the user to verify that they match. 9 | 10 | There are two companion python scripts to prove that this example will work with unrelated PGP libraries. 11 | 12 | Running the `pgp_decrypter.py` will decrypt and print the message contained in the "encrypted_message.txt" file created by the "pgp_example" program. 13 | 14 | Running the `pgp_encrypter.py` will create an "encrypted_message.txt" file. Commenting out the line in `main.rs` that calls the `encrypt_message()` with the python generated "encrypted_message.txt" and then running the program will decrypt and print out the message from the script, which you will be able to see, is different from the Rust message. 15 | -------------------------------------------------------------------------------- /keys_from_files/key_files/pub.asc: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP PUBLIC KEY BLOCK----- 2 | 3 | xsFNBGKwuI4BEADO/Ji7C+wwPKiGso5QHrBys5+jF77Wsbil8MLj4EokxTITYxjR 4 | rh7feE41IZp0HFzvOhw1xCBq8iDh8OS6/krkf0lvTyUdPbOtGBTCBjVTwj4ocoIj 5 | K72O607Y0t09s/kqNDMGR+cnF57iFI4qpnNVjIJZjjwMD7A42cDVm/y0r5zhIvWR 6 | UqwcheuU4ttM/6vzJc/tcjIXvbquRs3XAWERm3HjzTXd/5wMCXT+2jWQVFYfAiSY 7 | Dng8bLNswkmb+4V6pteS9M3yVGkYwmcvkgMiLKezZaHhcD0CZmgpzUwGZf66a3fd 8 | +4KdiWDe2Vd/EaHIC/QlNOP+lxDX+2RrW2BkRpDuIvZnSXJ+OTMomuA2fMYh/MO6 9 | v2+INmEkCno10auoNGE4RnuOlRHrrvLhwl18b4H1D8+4Wz39KrxEzAVo2m4ozecM 10 | Jn7bY7SzpVrmnR+cWwly6w3zdj+/JrdfhP5PPwXZZKRBSxLjzMvCYzw42tiuqD4m 11 | CeMLojsh4n5aDtEJHdu3JmsESq7bZYw4uDQ3W6vYOgFF9lDIgedpY0uHVQl2XIu1 12 | YGLGZxSAjpt12Dua9zqQf999d/QmrgfSDLWMz6yakJAgnEXaCNq4bPWbTKSFOlOp 13 | 2i8F1nrdJQBcMpmzggE8KdmDCD6R0ZTpPgK/4sL8fwPPG9L+gXQzr3nkOQARAQAB 14 | zTV0ZXN0IHNjcmlwdCAoVGhlIHRlc3Qgc2NyaXB0cyBJRCkgPG5vbmVAbm9kb21h 15 | aW4uY29tPsLBigQTAQgANAUCYrC4kAIbDgQLCQgHBRUICQoLBRYCAwEAAh4BFiEE 16 | HSl8Yh1crgaLnYeNjK43+v56E1oACgkQjK43+v56E1puWw//Rz8wREy5Q+KaL+It 17 | iUrByt3rpsJWep/w27anAsvBtF0Tay6TgZfQ/PGXpGtwtTWRJpSniHyQZQrKZDdW 18 | NoZfOcMkV0TzsxIbspNt7oUk4qnEal28ANTCU2y6s4nzckWnFEbIrsQ0teH+jBkt 19 | cF08vrvgbGNkbDScefMbzJ3qTpcoH2TCR99i8oLmT6PwuKyfbhXVA6wt83Gim4zp 20 | lYr5+BFzaZsE8vM5rprhnWNppCCUtk5wDfSEvmbH2/bFmJUXZ1nzI6Y8EsrWEBcH 21 | r/c4dO+nF1VKeidhUcZDp6yawqu8poOpFmgN7kTQlap36w7awgaQtf7o8RpoBImM 22 | mA1I+VXR0jbVXosFtMK78Mzn583pS++qNG7DqENJfondUp/QEo5d/zcEukYS9nGE 23 | XGx6Gyk17rH1mwfIcTAwW5fJnYKC/ooDuiFm7Yh/kc/3ecmp6tQzd3GsieYFvUBQ 24 | BL4No4+uPUxovfli3T2IvVryKwyDcbhdcruWdD2uydSWgCCUpEnHKlOI7tDzPxnb 25 | tcWA5B7wAcT85w80FqNhn1MhbJ/ZLlS25BL1IMBWbcLdpOXMpTrvC+Hwq0uK7TwM 26 | h21C/vhUAmM6XBIRokZyaVueJ5DUOYAdu/QfQJ9vAHSO1MVojHB86O95uvBL4z60 27 | bdFA/OuPq551TG1ajy7dfmqpzmE= 28 | =+ag+ 29 | -----END PGP PUBLIC KEY BLOCK----- 30 | -------------------------------------------------------------------------------- /keys_from_files/key_files/sec.asc: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP PRIVATE KEY BLOCK----- 2 | 3 | xcZYBGKwuI4BEADO/Ji7C+wwPKiGso5QHrBys5+jF77Wsbil8MLj4EokxTITYxjR 4 | rh7feE41IZp0HFzvOhw1xCBq8iDh8OS6/krkf0lvTyUdPbOtGBTCBjVTwj4ocoIj 5 | K72O607Y0t09s/kqNDMGR+cnF57iFI4qpnNVjIJZjjwMD7A42cDVm/y0r5zhIvWR 6 | UqwcheuU4ttM/6vzJc/tcjIXvbquRs3XAWERm3HjzTXd/5wMCXT+2jWQVFYfAiSY 7 | Dng8bLNswkmb+4V6pteS9M3yVGkYwmcvkgMiLKezZaHhcD0CZmgpzUwGZf66a3fd 8 | +4KdiWDe2Vd/EaHIC/QlNOP+lxDX+2RrW2BkRpDuIvZnSXJ+OTMomuA2fMYh/MO6 9 | v2+INmEkCno10auoNGE4RnuOlRHrrvLhwl18b4H1D8+4Wz39KrxEzAVo2m4ozecM 10 | Jn7bY7SzpVrmnR+cWwly6w3zdj+/JrdfhP5PPwXZZKRBSxLjzMvCYzw42tiuqD4m 11 | CeMLojsh4n5aDtEJHdu3JmsESq7bZYw4uDQ3W6vYOgFF9lDIgedpY0uHVQl2XIu1 12 | YGLGZxSAjpt12Dua9zqQf999d/QmrgfSDLWMz6yakJAgnEXaCNq4bPWbTKSFOlOp 13 | 2i8F1nrdJQBcMpmzggE8KdmDCD6R0ZTpPgK/4sL8fwPPG9L+gXQzr3nkOQARAQAB 14 | AA//TsWIpl6CM1VSWXioektDoVNEpH/L687U06oNsUVRUi8NwJ0M+/dE3ozdTpEM 15 | Q7XrlEtMIxYRtEGTTAkuMw/FlrHuU4MOP9OUhoJMnA5ayxZ4K1JwvkvOJw7cAd41 16 | vl64q1wUMwa4LINrvuRNumOALwV7MfPUXE64JNqR7Xkgse7HSFLSm8yXnX9FyXKQ 17 | PPxsBuvT9qxn7esRmXNusK1gsJ+0txoIrwSw8U/EC50ll1jRMZnSLWAMWAqSOgiy 18 | lL8i7CuEjPPHULrZCEgrlsn9kUrnQ3mhIrdhMIGikI4FqcW1LGLryjoGWkfG6uhR 19 | yRT/ua766hH31pLNITUV4Vl0E+YIZYtvRO9QiCypKHsh8hPgjQuQ343F4q94+Yji 20 | +yauMJZrVsU4bb8irwQDS49IkdiA3Pfq7tDGQF/rLl2vUkPvIiVQ7iivb/Z0sMpU 21 | xefQ2tA5BOfn1HY3Qds9RCtZ3eydGnm/O+26xk8WaPGhZxoRwVkX45Sh19BiHQ0u 22 | avaNsfEpIUc4pxeLvAUQy9gxmVKojT84EXxNSiEe7yBz6X8TePc0wEMPgpN7m3uM 23 | 6Wkp7A7KDUWqDyvA+S6bbvcDRj8MSz+xagBOR6KucYiwDn6Io65eEg3aFDkpdbfd 24 | bJUJxyVSMppW3HdqqAlAvvgBpA1RQ4EWCElytBXs1WQSY1UIAO6p4iHu8w3gvH0P 25 | +vEyVeCbf18W26h0b8GnwIx89Wbuuva/n/EqKM8lO6XK9E10QAS1swrtLQgFjmE3 26 | adwlQJNKEtfVTA4Ccj4nq3zziav/maRKLEU0rtkIEtYG/Rq07KbazzX0u+q59Rvf 27 | Mkt/4c0AXxThnIHLoPm3rSeeIq+63q1jqN2M8X0WBDC/2GqMGPeS3K1rVrAZM2Lu 28 | MXivWGET8qArJhXM+8sCSZlw5F2308+DEOA1UO096z749DnkBKeesTG8DwMB0yiM 29 | +ipQdPe12+0nNFSZ6He4u8QQb9sMxbtzd9w8T4zygrmoZDvWYO2q1qHk3esr/weK 30 | +DeDXIMIAN4FqL2N1FdEiLR01C0jldjkvJVM7jZtCLJao7eBMqVVPBrTdOp8YmvU 31 | v/quIv0q1VU0dziGd3TgStcSgkQJAmu6lDohcILEEaKP/EWJwYu3i45Bq903dYMu 32 | FeiOpEjdsKi+m4u72gaZnfwkqBHMpxRSulsccMTZ8IrfBMZrFFmmagHUhY0ismOk 33 | KAIdkS6CsKdPG1me3hkzVsWaLe+GuLBO0BrfXpGqzliNG8wDUXr5JaaKWHf1lkFH 34 | tSlbkK7sCqxLBZD+PMCbCYuXnNQSpYe9Il4vHPkgH1FghNNMukyVqWoz+eW+4Uhq 35 | hL4vn/HBK7gE2l3mi/L25kLFwYKUF5MIAKiVDLyqMwRsGpe7vXZiyTgSArZIDGkw 36 | F1SjRS3jZmKffTF/9bJ8wfk92Ap/ae4fMZsaNPEhHw+xo48BJDJ9QGLT66LOJoCL 37 | LA4qluXb5TxetWPFFRVxB5/QlAqzVfrAol9rsmNVVn3mdeY+opGzzA1oAJSOoUqk 38 | IltHj9iz3DgtRYtXHwkDRnl0pvYVzLtRazni0QTihaa7IDZO87PbPskM+ZVxJfCD 39 | hE88k5RvG1oLzfwHaTFRvJpWqiZgXhqFSzRQQyETceUX86Az/fkIB8O+YmhMt9Sy 40 | 5UwIoZAFzOZnCbZPvR/ABVw9Mj4fJjswbDzQyH3n34oH0nAOXHW3zO53Xs01dGVz 41 | dCBzY3JpcHQgKFRoZSB0ZXN0IHNjcmlwdHMgSUQpIDxub25lQG5vZG9tYWluLmNv 42 | bT7CwYoEEwEIADQFAmKwuJACGw4ECwkIBwUVCAkKCwUWAgMBAAIeARYhBB0pfGId 43 | XK4Gi52HjYyuN/r+ehNaAAoJEIyuN/r+ehNablsP/0c/MERMuUPimi/iLYlKwcrd 44 | 66bCVnqf8Nu2pwLLwbRdE2suk4GX0Pzxl6RrcLU1kSaUp4h8kGUKymQ3VjaGXznD 45 | JFdE87MSG7KTbe6FJOKpxGpdvADUwlNsurOJ83JFpxRGyK7ENLXh/owZLXBdPL67 46 | 4GxjZGw0nHnzG8yd6k6XKB9kwkffYvKC5k+j8Lisn24V1QOsLfNxopuM6ZWK+fgR 47 | c2mbBPLzOa6a4Z1jaaQglLZOcA30hL5mx9v2xZiVF2dZ8yOmPBLK1hAXB6/3OHTv 48 | pxdVSnonYVHGQ6esmsKrvKaDqRZoDe5E0JWqd+sO2sIGkLX+6PEaaASJjJgNSPlV 49 | 0dI21V6LBbTCu/DM5+fN6UvvqjRuw6hDSX6J3VKf0BKOXf83BLpGEvZxhFxsehsp 50 | Ne6x9ZsHyHEwMFuXyZ2Cgv6KA7ohZu2If5HP93nJqerUM3dxrInmBb1AUAS+DaOP 51 | rj1MaL35Yt09iL1a8isMg3G4XXK7lnQ9rsnUloAglKRJxypTiO7Q8z8Z27XFgOQe 52 | 8AHE/OcPNBajYZ9TIWyf2S5UtuQS9SDAVm3C3aTlzKU67wvh8KtLiu08DIdtQv74 53 | VAJjOlwSEaJGcmlbnieQ1DmAHbv0H0CfbwB0jtTFaIxwfOjvebrwS+M+tG3RQPzr 54 | j6uedUxtWo8u3X5qqc5h 55 | =DMkw 56 | -----END PGP PRIVATE KEY BLOCK----- 57 | -------------------------------------------------------------------------------- /keys_from_files/pgp_decrypter.py: -------------------------------------------------------------------------------- 1 | from lib2to3.pgen2 import token 2 | import pgpy 3 | 4 | 5 | pgp_msg_file = "p1_armored_message.txt" 6 | 7 | 8 | def main(): 9 | privkey, _ = pgpy.PGPKey.from_file('./key_files/person_two/sec.asc') 10 | crypt_msg = pgpy.PGPMessage.from_file(pgp_msg_file) 11 | msg = privkey.decrypt(crypt_msg).message 12 | print(msg) 13 | 14 | 15 | if __name__ == "__main__": 16 | main() -------------------------------------------------------------------------------- /keys_from_files/pgp_encrypter.py: -------------------------------------------------------------------------------- 1 | from lib2to3.pgen2 import token 2 | import pgpy 3 | 4 | def main(): 5 | encrypted_msg_file = "encrypted_message.txt" 6 | public_key_file = "./key_files/pub.asc" 7 | secret_msg = "Secret message from python encoder script" 8 | 9 | pubkey, _ = pgpy.PGPKey.from_file(public_key_file) 10 | message = pgpy.PGPMessage.new(secret_msg) 11 | armored_msg = pubkey.encrypt(message) 12 | print(armored_msg, file=open(encrypted_msg_file, 'w')) 13 | 14 | 15 | if __name__ == "__main__": 16 | main() -------------------------------------------------------------------------------- /keys_from_files/src/main.rs: -------------------------------------------------------------------------------- 1 | #![allow(non_snake_case)] 2 | use anyhow::{Context, Result}; 3 | use pgp::{ 4 | composed::message::Message, composed::signed_key::*, crypto::sym::SymmetricKeyAlgorithm, 5 | Deserializable, 6 | }; 7 | use rand::prelude::*; 8 | use std::{fs, io::Cursor}; 9 | 10 | // While the keys used in this example are unique for each "person", the key password is the same for both 11 | const PUBLIC_KEY_FILE: &'static str = "./key_files/pub.asc"; 12 | const SECRET_KEY_FILE: &'static str = "./key_files/sec.asc"; 13 | const MSG_FILE_NAME: &'static str = "encrypted_message.txt"; 14 | const SECRET_MSG: &'static str = "This is the secret message!"; 15 | 16 | fn main() -> Result<()> { 17 | println!(" Original Message: {}", &SECRET_MSG); 18 | 19 | _ = encrypt_message(SECRET_MSG, PUBLIC_KEY_FILE).context("encrypting message")?; 20 | 21 | let encrypted_msg = 22 | fs::read_to_string(MSG_FILE_NAME).context("Reading encrypted message from file")?; 23 | let decrypted_msg = decrypt_message(&encrypted_msg.as_str(), SECRET_KEY_FILE)?; 24 | 25 | println!("Decrypted Message: {}", &decrypted_msg); 26 | 27 | Ok(()) 28 | } 29 | 30 | fn encrypt_message(msg: &str, pubkey_file: &str) -> Result { 31 | let pubkey = fs::read_to_string(pubkey_file) 32 | .context("Trying to load public key for Person Two from file")?; 33 | let (pubkey, _) = SignedPublicKey::from_string(pubkey.as_str())?; 34 | 35 | // Requires a file name as the first arg, in this case I pass "none", as it's not used typically, it's just meta data 36 | let msg = Message::new_literal("none", msg); 37 | 38 | let armored = generate_armored_string(msg, pubkey)?; 39 | _ = fs::write(&MSG_FILE_NAME, &armored).context("Writing encrypted message to file")?; 40 | 41 | Ok(armored) 42 | } 43 | 44 | fn generate_armored_string(msg: Message, pk: SignedPublicKey) -> Result { 45 | let mut rng = StdRng::from_entropy(); 46 | let new_msg = msg.encrypt_to_keys(&mut rng, SymmetricKeyAlgorithm::AES128, &[&pk])?; 47 | Ok(new_msg.to_armored_string(None)?) 48 | } 49 | 50 | fn decrypt_message(armored: &str, seckey_file: &str) -> Result { 51 | let seckey = fs::read_to_string(seckey_file)?; 52 | let (seckey, _) = SignedSecretKey::from_string(seckey.as_str())?; 53 | 54 | let buf = Cursor::new(armored); 55 | let (msg, _) = Message::from_armor_single(buf)?; 56 | let (decryptor, _) = msg 57 | .decrypt(|| String::from(""), || String::from(""), &[&seckey]) 58 | .context("Decrypting the message")?; 59 | 60 | for msg in decryptor { 61 | let bytes = msg?.get_content()?.unwrap(); 62 | let clear = String::from_utf8(bytes)?; 63 | if String::len(&clear) > 0 { 64 | return Ok(clear); 65 | } 66 | } 67 | 68 | Err(anyhow::Error::msg("Failed to find message")) 69 | } 70 | --------------------------------------------------------------------------------