Skip to content

Commit

Permalink
Rebrand Data Security Manager (#36)
Browse files Browse the repository at this point in the history
Fortanix SDKMS is now Data Security Manager (DSM)

https://fortanix.com/products/data-security-manager
  • Loading branch information
zugzwang committed Dec 22, 2021
1 parent 0ee23e9 commit 18ce3aa
Show file tree
Hide file tree
Showing 21 changed files with 198 additions and 197 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ members = [
"ipc",
"net",
"openpgp",
"openpgp-sdkms",
"openpgp-dsm",
"sq",
]

Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
sq-sdkms
sq-dsm
========

This fork of [Sequoia-PGP][Sequoia] leverages
[sdkms-client-rust][sdkms-client-rust] to perform OpenPGP operations with keys
stored in the [Fortanix Self-Defending Key-Management System][SDKMS], adding
options to the existing CLI Sequoia frontend, `sq`.
stored in the [Fortanix Data Security Manager][DSM], adding options to the
existing CLI Sequoia frontend, `sq`.

### Motivation

Sequoia-PGP defines the [Decryptor][sequoia::Decryptor] and
[Signer][sequoia::Signer] traits for low-level cryptographic operations
with secret key material, and abstracts over these traits for PGP formatting.
This fork implements Decryptor and Signer for secrets stored inside
Fortanix SDKMS, enabling the production of PGP material without the need to
Fortanix DSM, enabling the production of PGP material without the need to
export private keys.

### Additional requirements

Install requirements for [rust-mbedtls][rust-mbedtls]. The following
variables need to be set in order to communicate with SDKMS.
variables need to be set in order to communicate with DSM.

- `FORTANIX_API_ENDPOINT`, your SDKMS API endpoint,
- `FORTANIX_API_ENDPOINT`, your DSM API endpoint,
- `FORTANIX_API_KEY`, your app's API key.


### Example usage of added options

In the following example, Alice holds a PGP key whose secrets are stored in
SDKMS, and Bob and Charlie hold regular PGP keys.
DSM, and Bob and Charlie hold regular PGP keys.

1. Generate an SDKMS key for Alice, and local keys for Bob and Charlie
1. Generate a DSM key for Alice, and local keys for Bob and Charlie
```
$ sq key generate --sdkms-key="alice" --cipher-suite="nistp521" --userid="Alice <[email protected]>"
$ sq key generate --dsm-key="alice" --cipher-suite="nistp521" --userid="Alice <[email protected]>"
$ sq key generate --cipher-suite="rsa3k" --userid="Bob <[email protected]> --export="bob.asc"
$ sq key generate --userid="Charlie <[email protected]> --export="charlie.asc"
```

2. Recover Alice's Transferable Public Key (TPK)
```
$ sq key extract-cert --sdkms-key="alice" > alice.asc
$ sq key extract-cert --dsm-key="alice" > alice.asc
```

3. Create a file, sign it with Alices's key, and verify it
```
$ echo "Hello, World!" > msg.txt
$ sq sign --sdkms-key="alice" msg.txt > msg.txt.signed
$ sq sign --dsm-key="alice" msg.txt > msg.txt.signed
$ sq verify --signer-cert=alice.asc msg.txt.signed
Good signature from B4C961DE2204FD02
Expand All @@ -56,7 +56,7 @@ Hello, World!
4. Encrypt a file to Alice, signed by Bob, and decrypt it
```
$ sq encrypt --recipient-cert=alice.asc --signer-key=bob.asc msg.txt > to_alice.asc
$ sq decrypt --sdkms-key="alice" --signer-cert=bob.asc to_alice.asc
$ sq decrypt --dsm-key="alice" --signer-cert=bob.asc to_alice.asc
Encrypted using AES with 256-bit key
Compressed using ZIP
Good signature from DC4358B3EA20F2C6
Expand All @@ -66,7 +66,7 @@ Hello, World!

5. Encrypt a file to Charlie, signed by both Alice and Bob, and decrypt it
```
$ sq encrypt --recipient-cert=charlie.asc --signer-sdkms-key=alice --signer-key=bob.asc msg.txt > to_charlie.asc
$ sq encrypt --recipient-cert=charlie.asc --signer-dsm-key=alice --signer-key=bob.asc msg.txt > to_charlie.asc
$ sq decrypt --recipient-key=charlie.asc --signer-cert=alice.asc --signer-cert=bob.asc to_charlie.asc
Encrypted using AES with 256-bit key
Compressed using ZIP
Expand All @@ -82,7 +82,7 @@ Hello, World!
[sequoia::Signer]: https://docs.sequoia-pgp.org/sequoia_openpgp/crypto/trait.Signer.html
[sequoia::Decryptor]: https://docs.sequoia-pgp.org/sequoia_openpgp/crypto/trait.Decryptor.html
[sdkms-client-rust]: https://github.com/fortanix/sdkms-client-rust
[SDKMS]: https://fortanix.com/products/data-security-manager/sdkms
[DSM]: https://fortanix.com/products/data-security-manager

--------------

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion openpgp-sdkms/Cargo.toml → openpgp-dsm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "openpgp-sdkms"
name = "openpgp-dsm"
version = "0.1.0"
authors = ["zugzwang <[email protected]>"]
edition = "2018"
Expand Down
2 changes: 1 addition & 1 deletion openpgp-sdkms/src/der.rs → openpgp-dsm/src/der.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ pub mod serialize {
}
_ => {
//
// Note: SDKMS expects UNRESTRICTED ALGORITHM IDENTIFIER
// Note: DSM expects UNRESTRICTED ALGORITHM IDENTIFIER
// AND PARAMETERS (RFC5480 sec. 2.1.1) for Nist curves
//
let nist_oid = Oid::from_slice(&[1, 2, 840, 10045, 2, 1]);
Expand Down
Loading

0 comments on commit 18ce3aa

Please sign in to comment.