Skip to content

Commit 7a2023e

Browse files
authored
Merge pull request #262 from umccr/feat/crypt4gh-storage
feat: Crypt4GH support using LocalStorage
2 parents 1156d85 + 4adac26 commit 7a2023e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+2363
-612
lines changed

Cargo.lock

Lines changed: 355 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

data/c4gh/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Crypt4GH example file
2+
3+
This is just a customised summary for htsget-rs. Please refer to the official [`crypt4gh-rust` documentation](https://ega-archive.github.io/crypt4gh-rust) for further information.
4+
5+
## Keygen
6+
7+
```sh
8+
cargo install crypt4gh
9+
crypt4gh keygen --sk keys/alice.sec --pk keys/alice.pub
10+
crypt4gh keygen --sk keys/bob.sec --pk keys/bob.pub
11+
```
12+
13+
## Encrypt
14+
```
15+
crypt4gh encrypt --sk keys/alice.sec --recipient_pk keys/bob.pub < htsnexus_test_NA12878.bam > htsnexus_test_NA12878.bam.c4gh
16+
```
17+
18+
## Decrypt
19+
20+
```sh
21+
crypt4gh decryptor --range 0-65535 --sk data/crypt4gh/keys/bob.sec \
22+
--sender-pk data/crypt4gh/keys/alice.pub \
23+
< data/crypt4gh/htsnexus_test_NA12878.bam.c4gh \
24+
> out.bam
25+
26+
samtools view out.bam
27+
(...)
28+
SRR098401.61822403 83 11 5009470 60 76M = 5009376 -169 TCTTCTTGCCCTGGTGTTTCGCCGTTCCAGTGCCCCCTGCTGCAGACCATAAAGGATGGGACTTTGTTGAGGTAGG ?B6BDCD@I?JFI?FHHFEAIIAHHDIJHHFIIIIIJEIIFIJGHCIJDDEEHHHDEHHHCIGGEGFDGFGFBEDC X0:i:1 X1:i:0 MD:Z:76 RG:Z:SRR098401 AM:i:37 NM:i:0 SM:i:37 MQ:i:60 XT:A:U BQ:Z:@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@B
29+
30+
samtools view: error reading file "out.bam"
31+
samtools view: error closing "out.bam": -1
32+
```
33+
34+
The last samtools view error suggests that the returned bytes do not include BAM file termination.
6.57 KB
Binary file not shown.
2.48 MB
Binary file not shown.
1.6 MB
Binary file not shown.
129 Bytes
Binary file not shown.

data/c4gh/keys/alice.pub

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-----BEGIN CRYPT4GH PUBLIC KEY-----
2+
ToQrpj4UfuLgxZRe1wSGIZtXC19fOEHUHe3RQy63qwM=
3+
-----END CRYPT4GH PUBLIC KEY-----

data/c4gh/keys/alice.sec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-----BEGIN CRYPT4GH PRIVATE KEY-----
2+
YzRnaC12MQAEbm9uZQAEbm9uZQAgxi4tNmUO++HAApv9ryZB9S8QfqrWKKe5CunJuChH5vU=
3+
-----END CRYPT4GH PRIVATE KEY-----

data/c4gh/keys/bob.pub

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-----BEGIN CRYPT4GH PUBLIC KEY-----
2+
TyKEXZPnfon6dj1kRXl6HumfZDzo/h60RIc8Wd0Ig2s=
3+
-----END CRYPT4GH PUBLIC KEY-----

data/c4gh/keys/bob.sec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-----BEGIN CRYPT4GH PRIVATE KEY-----
2+
YzRnaC12MQAEbm9uZQAEbm9uZQAg6uLXNqcXAi6FRKzRBk2KBKF4BnmueySZv5MGzKjIPcI=
3+
-----END CRYPT4GH PRIVATE KEY-----

0 commit comments

Comments
 (0)