crypt4gh 0.4.1

Encryption and decryption implementation of the Crypt4GH encryption format.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
<!DOCTYPE HTML>
<html lang="en" class="sidebar-visible no-js light">
    <head>
        <!-- Book generated using mdBook -->
        <meta charset="UTF-8">
        <title>Crypt4GH Format</title>
                <meta name="robots" content="noindex" />
                

        <!-- Custom HTML head -->
        

        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="How to share human genetic data securely">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="theme-color" content="#ffffff" />

                <link rel="icon" href="favicon.svg">
                        <link rel="shortcut icon" href="favicon.png">
                <link rel="stylesheet" href="css/variables.css">
        <link rel="stylesheet" href="css/general.css">
        <link rel="stylesheet" href="css/chrome.css">
                <link rel="stylesheet" href="css/print.css" media="print">
        
        <!-- Fonts -->
        <link rel="stylesheet" href="FontAwesome/css/font-awesome.css">
                <link rel="stylesheet" href="fonts/fonts.css">
        
        <!-- Highlight.js Stylesheets -->
        <link rel="stylesheet" href="highlight.css">
        <link rel="stylesheet" href="tomorrow-night.css">
        <link rel="stylesheet" href="ayu-highlight.css">

        <!-- Custom theme stylesheets -->
        
            </head>
    <body>
        <!-- Provide site root to javascript -->
        <script type="text/javascript">
            var path_to_root = "";
            var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light";
        </script>

        <!-- Work around some values being stored in localStorage wrapped in quotes -->
        <script type="text/javascript">
            try {
                var theme = localStorage.getItem('mdbook-theme');
                var sidebar = localStorage.getItem('mdbook-sidebar');

                if (theme.startsWith('"') && theme.endsWith('"')) {
                    localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
                }

                if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
                    localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
                }
            } catch (e) { }
        </script>

        <!-- Set the theme before any content is loaded, prevents flash -->
        <script type="text/javascript">
            var theme;
            try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
            if (theme === null || theme === undefined) { theme = default_theme; }
            var html = document.querySelector('html');
            html.classList.remove('no-js')
            html.classList.remove('light')
            html.classList.add(theme);
            html.classList.add('js');
        </script>

        <!-- Hide / unhide sidebar before it is displayed -->
        <script type="text/javascript">
            var html = document.querySelector('html');
            var sidebar = 'hidden';
            if (document.body.clientWidth >= 1080) {
                try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
                sidebar = sidebar || 'visible';
            }
            html.classList.remove('sidebar-visible');
            html.classList.add("sidebar-" + sidebar);
        </script>

        <nav id="sidebar" class="sidebar" aria-label="Table of contents">
            <div class="sidebar-scrollbox">
                <ol class="chapter"><li class="chapter-item expanded "><a href="0_intro.html"><strong aria-hidden="true">1.</strong> Introduction</a></li><li class="chapter-item expanded "><a href="1_installation.html"><strong aria-hidden="true">2.</strong> Installation</a></li><li class="chapter-item expanded "><a href="2_encryption.html"><strong aria-hidden="true">3.</strong> Encryption</a></li><li class="chapter-item expanded "><a href="3_key_format.html"><strong aria-hidden="true">4.</strong> Key Format</a></li><li class="chapter-item expanded "><a href="4_usage_and_examples.html"><strong aria-hidden="true">5.</strong> Usage &amp; Examples</a></li><li class="chapter-item expanded "><a href="5_rust_library.html"><strong aria-hidden="true">6.</strong> Rust Library</a></li></ol>            </div>
            <div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
        </nav>

        <div id="page-wrapper" class="page-wrapper">

            <div class="page">
                
                <div id="menu-bar-hover-placeholder"></div>
                <div id="menu-bar" class="menu-bar sticky bordered">
                    <div class="left-buttons">
                        <button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
                            <i class="fa fa-bars"></i>
                        </button>
                        <button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
                            <i class="fa fa-paint-brush"></i>
                        </button>
                        <ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
                            <li role="none"><button role="menuitem" class="theme" id="light">Light (default)</button></li>
                            <li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
                            <li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
                            <li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
                            <li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
                        </ul>
                                                <button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
                            <i class="fa fa-search"></i>
                        </button>
                                            </div>

                    <h1 class="menu-title">Crypt4GH Format</h1>

                    <div class="right-buttons">
                                                <a href="print.html" title="Print this book" aria-label="Print this book">
                            <i id="print-button" class="fa fa-print"></i>
                        </a>
                                                                        
                    </div>
                </div>

                                <div id="search-wrapper" class="hidden">
                    <form id="searchbar-outer" class="searchbar-outer">
                        <input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
                    </form>
                    <div id="searchresults-outer" class="searchresults-outer hidden">
                        <div id="searchresults-header" class="searchresults-header"></div>
                        <ul id="searchresults">
                        </ul>
                    </div>
                </div>
                
                <!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
                <script type="text/javascript">
                    document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
                    document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
                    Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
                        link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
                    });
                </script>

                <div id="content" class="content">
                    <main>
                        <h1 id="crypt4gh-utility"><a class="header" href="#crypt4gh-utility">Crypt4GH utility</a></h1>
<h2 id="introduction"><a class="header" href="#introduction">Introduction</a></h2>
<p>Bob wants to send a message to Alice, containing sensitive data. Bob uses <a href="https://www.ga4gh.org/news/crypt4gh-a-secure-method-for-sharing-human-genetic-data/">Crypt4GH, the Global Alliance approved secure method for sharing human genetic data</a></p>
<p>crypt4gh, a Rust tool to encrypt, decrypt or re-encrypt files, according to the <a href="http://samtools.github.io/hts-specs/crypt4gh.pdf">GA4GH encryption file format</a>. <a href="https://www.ga4gh.org/news/crypt4gh-a-secure-method-for-sharing-human-genetic-data/"><img src="https://www.ga4gh.org/wp-content/uploads/Crypt4GH_comic.png" alt="How Crypt4GH works" /></a></p>
<h2 id="basic-example"><a class="header" href="#basic-example">Basic example</a></h2>
<p>Alice and Bob generate both a pair of public/private keys.</p>
<pre><code class="language-sh">crypt4gh keygen --sk alice.sec --pk alice.pub
crypt4gh keygen --sk bob.sec --pk bob.pub
</code></pre>
<p>Bob encrypts a file for Alice:</p>
<pre><code class="language-sh">crypt4gh encrypt --sk bob.sec --recipient_pk alice.pub &lt; file &gt; file.c4gh
</code></pre>
<p>Alice decrypts the encrypted file:</p>
<pre><code class="language-sh">crypt4gh decrypt --sk alice.sec &lt; file.c4gh
</code></pre>
<div style="break-before: page; page-break-before: always;"></div><h1 id="installation"><a class="header" href="#installation">Installation</a></h1>
<h2 id="requirements"><a class="header" href="#requirements">Requirements</a></h2>
<p>You need to install Rust in order to compile the source code.</p>
<blockquote>
<p>To build from source on <strong>Windows</strong>, you should first have installed the <a href="https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019">MSVC Build Tools</a>.</p>
</blockquote>
<h3 id="linux-macos-or-another-unix-like-os"><a class="header" href="#linux-macos-or-another-unix-like-os">Linux, MacOS or another Unix-like OS</a></h3>
<p>To download Rustup and install Rust, run the following in your terminal, then follow the on-screen instructions.</p>
<pre><code class="language-sh">curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
</code></pre>
<h3 id="windows"><a class="header" href="#windows">Windows</a></h3>
<p>Download and run the following executable: <a href="https://static.rust-lang.org/rustup/dist/i686-pc-windows-gnu/rustup-init.exe">rustup-init.exe</a></p>
<h3 id="other-ways-to-install-rust"><a class="header" href="#other-ways-to-install-rust">Other ways to install Rust</a></h3>
<p>If you prefer not to use the shell script, you may directly download rustup-init for the platform of your choice <a href="https://forge.rust-lang.org/infra/other-installation-methods.html#other-ways-to-install-rustup">here</a>.</p>
<h2 id="building-from-source-recommended"><a class="header" href="#building-from-source-recommended">Building from source (recommended)</a></h2>
<p>Once installed, you can install <code>crypt4gh</code> executing the following in your terminal:</p>
<pre><code class="language-sh">cargo install crypt4gh
</code></pre>
<h2 id="standalone-binaries"><a class="header" href="#standalone-binaries">Standalone binaries</a></h2>
<p>In the <a href="https://github.com/EGA-archive/crypt4gh-rust/releases/latest">releases page</a>, You can find compiled binaries for:</p>
<ul>
<li><a href="https://github.com/EGA-archive/crypt4gh-rust/releases/latest/download/Linux.zip">Linux (x86_64-unknown-linux-gnu)</a></li>
<li><a href="https://github.com/EGA-archive/crypt4gh-rust/releases/latest/download/macOS.zip">OS X (x86_64-apple-darwin)</a></li>
<li><a href="https://github.com/EGA-archive/crypt4gh-rust/releases/latest/download/Windows.zip">Windows (x86_64-pc-windows-msvc)</a></li>
</ul>
<h2 id="issues"><a class="header" href="#issues">Issues</a></h2>
<p>If you have any issue with the installation please <a href="https://github.com/EGA-archive/crypt4gh-rust/issues/new">create an issue on Github</a>.</p>
<div style="break-before: page; page-break-before: always;"></div><h1 id="encryption-algorithm---crypt4gh"><a class="header" href="#encryption-algorithm---crypt4gh">Encryption Algorithm - Crypt4GH</a></h1>
<h2 id="encryption-format"><a class="header" href="#encryption-format">Encryption Format</a></h2>
<p>A random session key (of 256 bits) is generated to seed a ChaCha20 engine, with Poly1305 authentication mode. For each segment of at most 64kB of data, a nonce is randomly generated and prepended to the segment. Using the two latters, the original file is segmented and each segment is encrypted.</p>
<p>The header is prepended to the encrypted data.</p>
<p>Informally, the header contains, the word <code>crypt4gh</code>, the format version (currently 1), the number of header packets, and the sequence of header packets.</p>
<p>A header packet is a length followed by its content. The content can be a data encryption packet or an edit list packet.</p>
<p>All packets are encrypted using a Curve25519-based encryption.</p>
<p><img src="https://crypt4gh.readthedocs.io/en/latest/_images/encryption.png" alt="Encryption process" /></p>
<h2 id="features"><a class="header" href="#features">Features</a></h2>
<p>The advantages of the format are, among others:</p>
<ul>
<li>Re-encrypting the file for another user requires only to decrypt the header and encrypt it with the user’s public key.</li>
<li>Header packets can be encrypted for multiple recipients.</li>
<li>Re-arranging the file to chunk a portion requires only to decrypt the header, re-encrypt with an edit list, and select the cipher segments surrounding the portion. The file itself is not decrypted and reencrypted.</li>
</ul>
<div style="break-before: page; page-break-before: always;"></div><h1 id="crypt4gh-key-format"><a class="header" href="#crypt4gh-key-format">Crypt4GH Key Format</a></h1>
<blockquote>
<p>This utility supports OpenSSH key-format (version 6.5 or above) if the key was generated with type ed25519 (i.e. with <code>ssh-keygen -t ed25519 ...</code>). Otherwise, this utility can generate keys in the following format:</p>
</blockquote>
<h2 id="keys"><a class="header" href="#keys">Keys</a></h2>
<p>A key is stored in the following PEM format:</p>
<pre><code class="language-text">-----BEGIN CRYPT4GH &lt;type&gt; KEY-----
BASE64-ENCODED DATA
-----END CRYPT4GH &lt;type&gt; KEY-----
</code></pre>
<p>where <code>&lt;type&gt;</code> is either PUBLIC or PRIVATE.</p>
<h3 id="public-key-data"><a class="header" href="#public-key-data">Public key data</a></h3>
<p>For a public key, the key data is the byte representation of the plaintext key material.</p>
<h3 id="private-key-data"><a class="header" href="#private-key-data">Private key data</a></h3>
<p>For a private key, we use the following encoding format.</p>
<pre><code class="language-py">byte[]  MAGIC_WORD
string  kdfname
string  (rounds || salt)     # included if kdfname is not &quot;none&quot;
string  ciphername
string  private blob         # Key material encrypted or not
string  comment              # Optional
</code></pre>
<ol>
<li>
<p>The <strong>MAGIC_WORD</strong> is the byte-representation of the ASCII word &quot;c4gh-v1&quot;.</p>
<blockquote>
<p>Everything <code>string</code> consists of a length n (encoded as 2 big-endian bytes) and a sequence of n bytes (i.e. the <code>string</code> &quot;hello&quot;, is encoded as <code>\x00\x05hello</code>).</p>
</blockquote>
</li>
<li>
<p>The <strong>kdfname</strong> is the name of the Key Derivation Function. We support either <code>&quot;scrypt&quot;</code>, <code>&quot;pbkdf2_hmac_sha256&quot;</code>, <code>&quot;bcrypt&quot;</code>, or <code>&quot;none&quot;</code>. The Rust implementation uses scrypt when available, and defaults to bcrypt for generating keys.</p>
</li>
<li>
<p>The <strong>rounds</strong> is a 4 big-endian bytes representation of the number of iterations used in the KDF.</p>
</li>
<li>
<p>The <strong>ciphername</strong> describes which symmetric algorithm is used to generate the encrypted data, as follows. The only supported cipher is <code>&quot;chacha20_poly1305&quot;</code> (so far), or &quot;none&quot;.</p>
<blockquote>
<p>When kdfname is none, so should the ciphername be (and vice-versa), and the (rounds || salt) string is not included. This is used when the key material is not encrypted.</p>
</blockquote>
</li>
<li>
<p>In case the key material is encrypted, the KDF is used to derive a secret from a user-supplied passphrase. A nonce is randomly generated, and used in conjunction with the secret to encrypt the private key, using Chacha20 and authenticated with Poly1305. The nonce is prepended to the <strong>encrypted data</strong>.</p>
</li>
<li>
<p>Finally, an optional <strong>comment</strong> can be used at the end of the encoded format.</p>
</li>
</ol>
<h2 id="examples"><a class="header" href="#examples">Examples</a></h2>
<h3 id="crypt4gh-key-generation"><a class="header" href="#crypt4gh-key-generation">Crypt4GH Key generation</a></h3>
<pre><code class="language-sh">crypt4gh keygen --sk user.sec --pk user.pub
</code></pre>
<h3 id="openssh-key-generation"><a class="header" href="#openssh-key-generation">OpenSSH Key generation</a></h3>
<pre><code class="language-sh">ssh-keygen -t ed25519 -f &lt;output_filepath&gt; -N &lt;passphrase&gt;
</code></pre>
<div style="break-before: page; page-break-before: always;"></div><h1 id="usage--examples"><a class="header" href="#usage--examples">Usage &amp; Examples</a></h1>
<p>The usual <code>--help</code> flag shows you the different options that the tool accepts.</p>
<pre><code class="language-text">$ crypt4gh --help

Utility for the cryptographic GA4GH standard, reading from stdin and outputting to stdout.

USAGE:
    crypt4gh [FLAGS] [SUBCOMMAND]

FLAGS:
    -h, --help       Prints help information
    -v, --verbose    Sets the level of verbosity
    -V, --version    Prints version information

SUBCOMMANDS:
    decrypt      Decrypts the input using your secret key and the (optional) public key of the sender.
    encrypt      Encrypts the input using your (optional) secret key and the public key of the recipient.
    help         Prints this message or the help of the given subcommand(s)
    keygen       Utility to create Crypt4GH-formatted keys.
    rearrange    Rearranges the input according to the edit list packet.
    reencrypt    Decrypts the input using your (optional) secret key and then it reencrypts it using the
                 public key of the recipient.
</code></pre>
<h2 id="keygen"><a class="header" href="#keygen">Keygen</a></h2>
<pre><code class="language-text">$ crypt4gh keygen --help

crypt4gh-keygen
Utility to create Crypt4GH-formatted keys.

USAGE:
    crypt4gh keygen [FLAGS] [OPTIONS]

FLAGS:
    -f               Overwrite the destination files
    -h, --help       Prints help information
        --nocrypt    Do not encrypt the private key. Otherwise it is encrypted in the Crypt4GH key
                     format (See https://crypt4gh.readthedocs.io/en/latest/keys.html)
    -V, --version    Prints version information

OPTIONS:
    -C, --comment &lt;comment&gt;    Key's Comment
        --pk &lt;keyfile&gt;         Curve25519-based Public key [env: C4GH_PUBLIC_KEY] [default:
                               ~/.c4gh/key.pub]
        --sk &lt;keyfile&gt;         Curve25519-based Private key [env: C4GH_SECRET_KEY] [default:
                               ~/.c4gh/key]
</code></pre>
<p>Generate a Crypt4GH Key for Alice and Bob.</p>
<pre><code class="language-sh">crypt4gh keygen --sk alice.sec --pk alice.pub
</code></pre>
<pre><code class="language-sh">crypt4gh keygen --sk bob.sec --pk bob.pub
</code></pre>
<h2 id="encrypt"><a class="header" href="#encrypt">Encrypt</a></h2>
<pre><code class="language-text">$ crypt4gh encrypt --help

crypt4gh-encrypt
Encrypts the input using your (optional) secret key and the public key of the recipient.

USAGE:
    crypt4gh encrypt [OPTIONS] --recipient_pk &lt;path&gt;...

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
        --range &lt;start-end&gt;         Byte-range either as  &lt;start-end&gt; or just &lt;start&gt; (Start
                                    included, End excluded)
        --recipient_pk &lt;path&gt;...    Recipient's Curve25519-based Public key
        --sk &lt;path&gt;                 Curve25519-based Private key [env: C4GH_SECRET_KEY]
</code></pre>
<p>Alice encrypts a file <code>file.txt</code> for Bob:</p>
<pre><code class="language-sh">crypt4gh encrypt --sk alice.sec --recipient_pk bob.pub &lt; original_file.txt &gt; encrypted_file.c4gh
</code></pre>
<h2 id="decrypt"><a class="header" href="#decrypt">Decrypt</a></h2>
<pre><code class="language-text">$ crypt4gh decrypt --help

crypt4gh-decrypt
Decrypts the input using your secret key and the (optional) public key of the sender.

USAGE:
    crypt4gh decrypt [OPTIONS]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
        --sender_pk &lt;path&gt;    Peer's Curve25519-based Public key to verify provenance (akin to
                              signature)
        --sk &lt;path&gt;           Curve25519-based Private key. [env: C4GH_SECRET_KEY]
</code></pre>
<p>Bob decrypts an encrypted file:</p>
<pre><code class="language-sh">crypt4gh decrypt --sk bob.sec &lt; encrypted_file.c4gh &gt; decrypted_file.txt
</code></pre>
<p>If Bob wants to, optionally, verify that the message indeed comes from Alice, he needs to fetch Alice's public key via another trusted channel. He can then decrypt and check the provenance of the file with:</p>
<pre><code class="language-sh">crypt4gh decrypt --sk bob.sec --sender_pk alice.pub &lt; encrypted_file.c4gh &gt; decrypted_file.txt
</code></pre>
<h2 id="reencrypt"><a class="header" href="#reencrypt">Reencrypt</a></h2>
<pre><code class="language-text">$ crypt4gh reencrypt --help

crypt4gh-reencrypt
Decrypts the input using your (optional) secret key and then it reencrypts it using the public key
of the recipient.

USAGE:
    crypt4gh reencrypt [FLAGS] [OPTIONS] --recipient_pk &lt;path&gt;...

FLAGS:
    -h, --help       Prints help information
    -t, --trim       Keep only header packets that you can decrypt
    -V, --version    Prints version information

OPTIONS:
        --recipient_pk &lt;path&gt;...    Recipient's Curve25519-based Public key
        --sk &lt;path&gt;                 Curve25519-based Private key [env: C4GH_SECRET_KEY]
</code></pre>
<p>Bob reencrypts a file for alice and for himself:</p>
<pre><code class="language-sh">crypt4gh reencrypt --sk bob.sec --recipient_pk alice.pub bob.pub &lt; encrypted_file.c4gh &gt; reencrypted_file.c4gh
</code></pre>
<h2 id="rearrange"><a class="header" href="#rearrange">Rearrange</a></h2>
<pre><code class="language-text">$ crypt4gh rearrange --help

crypt4gh-rearrange
Rearranges the input according to the edit list packet.

USAGE:
    crypt4gh rearrange [OPTIONS] --range &lt;start-end&gt;

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
        --range &lt;start-end&gt;    Byte-range either as  &lt;start-end&gt; or just &lt;start&gt; (Start included,
                               End excluded)
        --sk &lt;path&gt;            Curve25519-based Private key [env: C4GH_SECRET_KEY]
</code></pre>
<p>Bob rearranges an encrypted file with the bytes from 65535 to 131074:</p>
<pre><code class="language-sh">crypt4gh rearrange --sk bob.sec --range 65535-131074 &lt; encrypted_file.c4gh &gt; rearranged_file.c4gh
</code></pre>
<div style="break-before: page; page-break-before: always;"></div><h1 id="rust-library"><a class="header" href="#rust-library">Rust Library</a></h1>
<p>You can check the documentation of the Rust library on <a href="https://docs.rs/crypt4gh/latest/crypt4gh">docs.rs</a>.</p>

                    </main>

                    <nav class="nav-wrapper" aria-label="Page navigation">
                        <!-- Mobile navigation buttons -->
                        
                        
                        <div style="clear: both"></div>
                    </nav>
                </div>
            </div>

            <nav class="nav-wide-wrapper" aria-label="Page navigation">
                
                            </nav>

        </div>

        
        
        
                <script type="text/javascript">
            window.playground_copyable = true;
        </script>
        
        
                <script src="elasticlunr.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="mark.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="searcher.js" type="text/javascript" charset="utf-8"></script>
        
        <script src="clipboard.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="highlight.js" type="text/javascript" charset="utf-8"></script>
        <script src="book.js" type="text/javascript" charset="utf-8"></script>

        <!-- Custom JS scripts -->
        
                        <script type="text/javascript">
        window.addEventListener('load', function() {
            window.setTimeout(window.print, 100);
        });
        </script>
                
    </body>
</html>