| 1 |
--- |
| 2 |
title: "Sequoia-PGP sq" |
| 3 |
subtitle: "integration tests, requirements, acceptance criteria" |
| 4 |
authors: "The Sequoia-PGP project" |
| 5 |
bindings: |
| 6 |
- subplot/sq-subplot.yaml |
| 7 |
- lib/files.yaml |
| 8 |
- lib/runcmd.yaml |
| 9 |
impls: |
| 10 |
rust: |
| 11 |
- subplot/sq-subplot.rs |
| 12 |
classes: |
| 13 |
- json |
| 14 |
... |
| 15 |
|
| 16 |
# Introduction |
| 17 |
|
| 18 |
The [Sequoia-PGP][] project is an implementation of the [OpenPGP][] |
| 19 |
standard for encryption and digital signatures. Sequoia itself is a |
| 20 |
library for the Rust programming language, as well as the `sq` command |
| 21 |
line tool for people to use directly. This document captures the |
| 22 |
requirements and acceptance criteria for the `sq` tool and how they |
| 23 |
are verified, and at the same time acts as an integration test for the |
| 24 |
tool. |
| 25 |
|
| 26 |
[Sequoia-PGP]: https://sequoia-pgp.org/ |
| 27 |
[OpenPGP]: https://en.wikipedia.org/wiki/Pretty_Good_Privacy#OpenPGP |
| 28 |
|
| 29 |
|
| 30 |
## Testing approach for sq |
| 31 |
|
| 32 |
This document explicitly only covers integration and acceptance |
| 33 |
testing of the `sq` command line tool. It does not try to verify that |
| 34 |
the underlying library implements OpenPGP correctly: the library has |
| 35 |
its own test suite for that. Instead, this document concentrates on |
| 36 |
making sure the `sq` command line tool behaves as it should from an |
| 37 |
end-user's point of view. |
| 38 |
|
| 39 |
We make the following simplifying assumption: we know the `sq` |
| 40 |
developers as competent developers, and assume that they don't |
| 41 |
entangle unrelated functionality. By this we mean that we feel we can |
| 42 |
assume that the code in `sq` that reads input files is separate from the |
| 43 |
code that compresses it, which in turn is independent of the code that |
| 44 |
writes output as text or binary data. Thus, we verify each such |
| 45 |
functionality independently of each other. This drastically cuts down |
| 46 |
the number of feature combinations we need to test. If this assumption |
| 47 |
turns out to be incorrect, we will rethink and revise the testing |
| 48 |
approach as needed. |
| 49 |
|
| 50 |
We also know, by inspection, that `sq` uses the well-known, |
| 51 |
well-respected Rust library `clap` for parsing the command line. |
| 52 |
Because of this we feel it's not necessary to verify that, for |
| 53 |
example, `sq` notices that a required argument is missing from the |
| 54 |
command line, or that it notices that there are extra arguments |
| 55 |
present. We will concentrate on testing that when invoked with valid |
| 56 |
arguments results in expected output. |
| 57 |
|
| 58 |
## Using Subplot and this document |
| 59 |
|
| 60 |
The acceptance criteria and requirements are explained in prose and |
| 61 |
when they can be verified in an automated way, that is done using |
| 62 |
_test scenarios_. Both the prose and the scenarios are meant to be |
| 63 |
understood and agreed to by all stakeholders in the project. |
| 64 |
|
| 65 |
The [Subplot][] tool is used to render this document into |
| 66 |
human-readable form (HTML or PDF), and to generate a test program that |
| 67 |
executes the scenarios and checks they all pass. |
| 68 |
|
| 69 |
To achieve this, run the following commands: |
| 70 |
|
| 71 |
~~~sh |
| 72 |
$ git clone https://gitlab.com/sequoia-pgp/sequoia-sq.git |
| 73 |
$ cd sequoia-sq |
| 74 |
$ subplot docgen sq-subplot.md -o sq-subplot.html |
| 75 |
$ subplot docgen sq-subplot.md -o sq-subplot.pdf |
| 76 |
$ cargo test |
| 77 |
~~~ |
| 78 |
|
| 79 |
If you only care about generating and running tests, you only need to |
| 80 |
run `cargo test`. All the dependencies for that are automatically |
| 81 |
handled via `Cargo.toml`. |
| 82 |
|
| 83 |
To generate typeset documents (HTML and PDF), you need the following |
| 84 |
software installed: |
| 85 |
|
| 86 |
* [Subplot][], via cargo install or a Debian package (see its website) |
| 87 |
* Pandoc |
| 88 |
* Parts of TeX Live (for PDF) |
| 89 |
* Graphviz |
| 90 |
|
| 91 |
On a Debian system, that means the following packages: |
| 92 |
|
| 93 |
> `subplot pandoc pandoc-citeproc lmodern librsvg2-bin graphviz |
| 94 |
> texlive-latex-base texlive-latex-recommended |
| 95 |
> texlive-fonts-recommended plantuml` |
| 96 |
|
| 97 |
[Subplot]: https://subplot.liw.fi/ |
| 98 |
|
| 99 |
|
| 100 |
# Smoke test |
| 101 |
|
| 102 |
_Requirement: We must be able to invoke `sq` at all._ |
| 103 |
|
| 104 |
This scenario verifies that we can run `sq` in the simplest possible |
| 105 |
case: we ask the program for its version. If this works, then we know |
| 106 |
that the executable program exists, can be invoked, and at least some |
| 107 |
of its command line parsing code works. If this scenario doesn't work, |
| 108 |
then we can't expect anything else to work either. |
| 109 |
|
| 110 |
~~~scenario |
| 111 |
given an installed sq |
| 112 |
when I run sq version |
| 113 |
then exit code is 0 |
| 114 |
then stderr matches regex ^sq \d+\.\d+\.\d+ |
| 115 |
~~~ |
| 116 |
|
| 117 |
# Key management: `sq key` |
| 118 |
|
| 119 |
This chapter covers all key management functionality: the `sq key` |
| 120 |
subcommands. |
| 121 |
|
| 122 |
## Key generation: `sq key generate` |
| 123 |
|
| 124 |
This section covers key generation with `sq`. Keys are somewhat |
| 125 |
complicated: it is possible to have keys for specify that they can |
| 126 |
only used for specific operations, or the time period when they are |
| 127 |
valid. Different cryptographic algorithms have different kinds of |
| 128 |
keys. We verify these by varying what kind keys we generate and that |
| 129 |
they look as expected, when inspected. |
| 130 |
|
| 131 |
### Generate a key with defaults |
| 132 |
|
| 133 |
_Requirement: We must be able to generate new encryption keys and |
| 134 |
corresponding certificates._ |
| 135 |
|
| 136 |
This scenario generates a new key with `sq` using default settings and |
| 137 |
inspects it to see if it looks at least vaguely correct. Note that in |
| 138 |
this scenario we don't verify that the key works, other scenarios take |
| 139 |
care of that. Here we merely verify that the new key looks OK. |
| 140 |
|
| 141 |
~~~scenario |
| 142 |
given an installed sq |
| 143 |
when I run sq key generate --own-key --without-password --userid Alice --output key.pgp --rev-cert key.pgp.rev |
| 144 |
when I run sq inspect key.pgp |
| 145 |
then stdout contains "Alice" |
| 146 |
then stdout contains "Expiration time: 20" |
| 147 |
then stdout contains "Key flags: certification" |
| 148 |
then stdout contains "Key flags: signing" |
| 149 |
then stdout contains "Key flags: authentication" |
| 150 |
then stdout contains "Key flags: transport encryption, data-at-rest encryption" |
| 151 |
~~~ |
| 152 |
|
| 153 |
### Generate key without user identifiers |
| 154 |
|
| 155 |
_Requirement: We must be able to generate new encryption keys without |
| 156 |
any user identifiers._ |
| 157 |
|
| 158 |
~~~scenario |
| 159 |
given an installed sq |
| 160 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev |
| 161 |
then file key.pgp contains "-----BEGIN PGP PRIVATE KEY BLOCK-----" |
| 162 |
~~~ |
| 163 |
|
| 164 |
|
| 165 |
### Generate key with more than one user identifier |
| 166 |
|
| 167 |
_Requirement: We must be able to generate new encryption keys with |
| 168 |
more than one user identifier._ |
| 169 |
|
| 170 |
~~~scenario |
| 171 |
given an installed sq |
| 172 |
when I run sq key generate --own-key --without-password --userid Alice --userid '<[email protected]>' --output key.pgp --rev-cert key.pgp.rev |
| 173 |
then file key.pgp contains "Comment: Alice" |
| 174 |
then file key.pgp contains "Comment: <[email protected]>" |
| 175 |
~~~ |
| 176 |
|
| 177 |
|
| 178 |
### Generate a key for certification only |
| 179 |
|
| 180 |
_Requirement: We must be able to generate a key that can only be used |
| 181 |
for certification, and can't be used for signing, encryption or authentication._ |
| 182 |
|
| 183 |
Note that `sq` always creates a key usable for certification. |
| 184 |
|
| 185 |
~~~scenario |
| 186 |
given an installed sq |
| 187 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev --cannot-sign --cannot-authenticate --cannot-encrypt |
| 188 |
when I run sq inspect key.pgp |
| 189 |
then stdout contains "Key flags: certification" |
| 190 |
then stdout doesn't contain "Key flags: signing" |
| 191 |
then stdout doesn't contain "Key flags: authentication" |
| 192 |
then stdout doesn't contain "Key flags: transport encryption, data-at-rest encryption" |
| 193 |
~~~ |
| 194 |
|
| 195 |
### Generate a key for encryption only |
| 196 |
|
| 197 |
_Requirement: We must be able to generate a key that can only be used |
| 198 |
for encryption, and can't be used for signing or authentication._ |
| 199 |
|
| 200 |
Note that `sq` always creates a key usable for certification. |
| 201 |
|
| 202 |
~~~scenario |
| 203 |
given an installed sq |
| 204 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev --cannot-sign --cannot-authenticate |
| 205 |
when I run sq inspect key.pgp |
| 206 |
then stdout contains "Key flags: certification" |
| 207 |
then stdout doesn't contain "Key flags: signing" |
| 208 |
then stdout doesn't contain "Key flags: authentication" |
| 209 |
then stdout contains "Key flags: transport encryption, data-at-rest encryption" |
| 210 |
~~~ |
| 211 |
|
| 212 |
### Generate a key for storage encryption only |
| 213 |
|
| 214 |
_Requirement: We must be able to generate a key that can only be used |
| 215 |
for at-rest (storage) encryption._ |
| 216 |
|
| 217 |
~~~scenario |
| 218 |
given an installed sq |
| 219 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev --can-encrypt=storage |
| 220 |
when I run sq inspect key.pgp |
| 221 |
then stdout contains "Key flags: certification" |
| 222 |
then stdout doesn't contain "transport encryption" |
| 223 |
then stdout contains "Key flags: data-at-rest encryption" |
| 224 |
~~~ |
| 225 |
|
| 226 |
### Generate a key for transport encryption only |
| 227 |
|
| 228 |
_Requirement: We must be able to generate a key that can only be used |
| 229 |
for transport encryption._ |
| 230 |
|
| 231 |
~~~scenario |
| 232 |
given an installed sq |
| 233 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev --can-encrypt=transport |
| 234 |
when I run sq inspect key.pgp |
| 235 |
then stdout contains "Key flags: certification" |
| 236 |
then stdout contains "Key flags: transport encryption" |
| 237 |
then stdout doesn't contain "data-at-rest encryption" |
| 238 |
~~~ |
| 239 |
|
| 240 |
### Generate a key for signing only |
| 241 |
|
| 242 |
_Requirement: We must be able to generate a key that can only be used |
| 243 |
for signing, and can't be used for encryption._ |
| 244 |
|
| 245 |
~~~scenario |
| 246 |
given an installed sq |
| 247 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev --cannot-encrypt --cannot-authenticate |
| 248 |
when I run sq inspect key.pgp |
| 249 |
then stdout contains "Key flags: certification" |
| 250 |
then stdout contains "Key flags: signing" |
| 251 |
then stdout doesn't contain "Key flags: transport encryption, data-at-rest encryption" |
| 252 |
then stdout doesn't contain "Key flags: authentication" |
| 253 |
~~~ |
| 254 |
|
| 255 |
|
| 256 |
### Generate a key for authentication only |
| 257 |
|
| 258 |
_Requirement: We must be able to generate a key that can only be used |
| 259 |
for authentication, and can't be used for encryption or signing._ |
| 260 |
|
| 261 |
Note that `sq` always creates a key usable for certification. |
| 262 |
|
| 263 |
~~~scenario |
| 264 |
given an installed sq |
| 265 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev --can-authenticate --cannot-sign --cannot-encrypt |
| 266 |
when I run sq inspect key.pgp |
| 267 |
then stdout contains "Key flags: certification" |
| 268 |
then stdout contains "Key flags: authentication" |
| 269 |
then stdout doesn't contain "Key flags: signing" |
| 270 |
then stdout doesn't contain "Key flags: transport encryption, data-at-rest encryption" |
| 271 |
~~~ |
| 272 |
|
| 273 |
|
| 274 |
### Generate a key for encryption and authentication |
| 275 |
|
| 276 |
_Requirement: We must be able to generate a key that can only be used |
| 277 |
for encryption and authentication, and can't be used for signing._ |
| 278 |
|
| 279 |
Note that `sq` always creates a key usable for certification. |
| 280 |
|
| 281 |
~~~scenario |
| 282 |
given an installed sq |
| 283 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev --cannot-sign |
| 284 |
when I run sq inspect key.pgp |
| 285 |
then stdout contains "Key flags: certification" |
| 286 |
then stdout contains "Key flags: authentication" |
| 287 |
then stdout contains "Key flags: transport encryption, data-at-rest encryption" |
| 288 |
then stdout doesn't contain "Key flags: signing" |
| 289 |
~~~ |
| 290 |
|
| 291 |
|
| 292 |
### Generate a key for encryption and signing |
| 293 |
|
| 294 |
_Requirement: We must be able to generate a key that can only be used |
| 295 |
for encryption and signing, and can't be used for authentication._ |
| 296 |
|
| 297 |
Note that `sq` always creates a key usable for certification. |
| 298 |
|
| 299 |
~~~scenario |
| 300 |
given an installed sq |
| 301 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev --cannot-authenticate |
| 302 |
when I run sq inspect key.pgp |
| 303 |
then stdout contains "Key flags: certification" |
| 304 |
then stdout contains "Key flags: transport encryption, data-at-rest encryption" |
| 305 |
then stdout contains "Key flags: signing" |
| 306 |
then stdout doesn't contain "Key flags: authentication" |
| 307 |
~~~ |
| 308 |
|
| 309 |
|
| 310 |
### Generate a key for signing and authentication |
| 311 |
|
| 312 |
_Requirement: We must be able to generate a key that can only be used |
| 313 |
for signing and authentication, and can't be used for encryption._ |
| 314 |
|
| 315 |
Note that `sq` always creates a key usable for certification. |
| 316 |
|
| 317 |
~~~scenario |
| 318 |
given an installed sq |
| 319 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev --cannot-encrypt |
| 320 |
when I run sq inspect key.pgp |
| 321 |
then stdout contains "Key flags: certification" |
| 322 |
then stdout doesn't contain "Key flags: transport encryption, data-at-rest encryption" |
| 323 |
then stdout contains "Key flags: signing" |
| 324 |
then stdout contains "Key flags: authentication" |
| 325 |
~~~ |
| 326 |
|
| 327 |
|
| 328 |
|
| 329 |
### Generate a key for encryption, authentication and signing |
| 330 |
|
| 331 |
_Requirement: We must be able to generate a key that can be used for |
| 332 |
encryption, authentication and signing._ |
| 333 |
|
| 334 |
Note that `sq` always creates a key usable for certification. |
| 335 |
|
| 336 |
~~~scenario |
| 337 |
given an installed sq |
| 338 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev |
| 339 |
when I run sq inspect key.pgp |
| 340 |
then stdout contains "Key flags: certification" |
| 341 |
then stdout contains "Key flags: authentication" |
| 342 |
then stdout contains "Key flags: transport encryption, data-at-rest encryption" |
| 343 |
then stdout contains "Key flags: signing" |
| 344 |
~~~ |
| 345 |
|
| 346 |
|
| 347 |
|
| 348 |
### Generate a version four elliptic curve key |
| 349 |
|
| 350 |
_Requirement: We must be able to generate a v4 Curve25519 key_ |
| 351 |
|
| 352 |
This is currently the default key, but we check it separately in case |
| 353 |
the default ever changes. |
| 354 |
|
| 355 |
~~~scenario |
| 356 |
given an installed sq |
| 357 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev --cipher-suite=cv25519 --profile=rfc4880 |
| 358 |
when I run sq inspect key.pgp |
| 359 |
then stdout contains "Public-key algo: EdDSA" |
| 360 |
then stdout contains "Public-key size: 256 bits" |
| 361 |
~~~ |
| 362 |
|
| 363 |
### Generate a version six elliptic curve key |
| 364 |
|
| 365 |
_Requirement: We must be able to generate a v6 Curve25519 key_ |
| 366 |
|
| 367 |
This is currently the default key, but we check it separately in case |
| 368 |
the default ever changes. |
| 369 |
|
| 370 |
~~~scenario |
| 371 |
given an installed sq |
| 372 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev --cipher-suite=cv25519 --profile=rfc9580 |
| 373 |
when I run sq inspect key.pgp |
| 374 |
then stdout contains "Public-key algo: Ed25519" |
| 375 |
then stdout contains "Public-key size: 256 bits" |
| 376 |
~~~ |
| 377 |
|
| 378 |
### Generate a three kilobit RSA key |
| 379 |
|
| 380 |
_Requirement: We must be able to generate a 3072-bit RSA key._ |
| 381 |
|
| 382 |
~~~scenario |
| 383 |
given an installed sq |
| 384 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev --cipher-suite=rsa3k |
| 385 |
when I run sq inspect key.pgp |
| 386 |
then stdout contains "Public-key algo: RSA" |
| 387 |
then stdout contains "Public-key size: 3072 bits" |
| 388 |
~~~ |
| 389 |
|
| 390 |
### Generate four kilobit RSA key |
| 391 |
|
| 392 |
_Requirement: We must be able to generate a 4096-bit RSA key._ |
| 393 |
|
| 394 |
~~~scenario |
| 395 |
given an installed sq |
| 396 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev --cipher-suite=rsa4k |
| 397 |
when I run sq inspect key.pgp |
| 398 |
then stdout contains "Public-key algo: RSA" |
| 399 |
then stdout contains "Public-key size: 4096 bits" |
| 400 |
~~~ |
| 401 |
|
| 402 |
### Generate a key with revocation certificate |
| 403 |
|
| 404 |
_Requirement: We must be able to specify where the revocation |
| 405 |
certificate is store._ |
| 406 |
|
| 407 |
When `sq` generates a key, it also generates a revocation certificate. |
| 408 |
By default, this is written to a file next to the key file. However, |
| 409 |
we need to able to specify where it goes. This scenario tests various |
| 410 |
cases. |
| 411 |
|
| 412 |
~~~scenario |
| 413 |
given an installed sq |
| 414 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev |
| 415 |
then file key.pgp.rev contains "Comment: Revocation certificate for" |
| 416 |
|
| 417 |
when I run sq key generate --own-key --without-password --no-userids --output key2.pgp --rev-cert rev.pgp |
| 418 |
then file rev.pgp contains "Comment: Revocation certificate for" |
| 419 |
~~~ |
| 420 |
|
| 421 |
### Generate a key with default duration |
| 422 |
|
| 423 |
_Requirement: By default, generated key expire._ |
| 424 |
|
| 425 |
We generate a key with defaults, and check the key expires. |
| 426 |
|
| 427 |
~~~scenario |
| 428 |
given an installed sq |
| 429 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev |
| 430 |
when I run sq inspect key.pgp |
| 431 |
then stdout contains "Expiration time: 20" |
| 432 |
~~~ |
| 433 |
|
| 434 |
The check for expiration time assumes the scenario is run the 21st |
| 435 |
century, and will need to be amended in the 2090s or by time |
| 436 |
travellers running it before about the year 2000. |
| 437 |
|
| 438 |
### Generate a key that expires at a given moment |
| 439 |
|
| 440 |
_Requirement: We must be able to generate a key that expires._ |
| 441 |
|
| 442 |
Note that the timestamp given to `--expire` is the first second when |
| 443 |
the key is no longer valid, not the last second it's valid. The |
| 444 |
inspect output is the last second of validity. |
| 445 |
|
| 446 |
~~~scenario |
| 447 |
given an installed sq |
| 448 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev --expiration=2038-01-19T03:14:07+00:00 |
| 449 |
when I run sq inspect key.pgp |
| 450 |
then stdout contains "Expiration time: 2038-01-19 03:14" |
| 451 |
when I run sq inspect --time 2038-01-20T00:00:00+00:00 key.pgp |
| 452 |
then stdout contains "Invalid: The primary key is not live" |
| 453 |
~~~ |
| 454 |
|
| 455 |
### Generate a key with a given duration |
| 456 |
|
| 457 |
_Requirement: We must be able to generate a key that expires in a |
| 458 |
given time._ |
| 459 |
|
| 460 |
~~~scenario |
| 461 |
given an installed sq |
| 462 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev --expiration=1y |
| 463 |
when I run sq inspect key.pgp |
| 464 |
then stdout contains "Expiration time: 20" |
| 465 |
~~~ |
| 466 |
|
| 467 |
### Generate a key without password |
| 468 |
|
| 469 |
_Requirement: We must be able to generate a that doesn't have a |
| 470 |
password._ |
| 471 |
|
| 472 |
~~~scenario |
| 473 |
given an installed sq |
| 474 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev |
| 475 |
when I run sq inspect key.pgp |
| 476 |
then stdout contains "Secret key: Unencrypted" |
| 477 |
~~~ |
| 478 |
|
| 479 |
### Generate a key with a password |
| 480 |
|
| 481 |
_Requirement: We must be able to generate a that does have a |
| 482 |
password._ |
| 483 |
|
| 484 |
~~~scenario |
| 485 |
given an installed sq |
| 486 |
given file password.txt |
| 487 |
when I run sq key generate --own-key --no-userids --output key.pgp --rev-cert key.pgp.rev --new-password-file password.txt |
| 488 |
when I run sq inspect key.pgp |
| 489 |
then stdout contains "Secret key: Encrypted" |
| 490 |
~~~ |
| 491 |
|
| 492 |
### Update a key by adding User IDs |
| 493 |
|
| 494 |
_Requirement: We must be able to generate a key and add User IDs to it._ |
| 495 |
|
| 496 |
~~~scenario |
| 497 |
given an installed sq |
| 498 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev |
| 499 |
when I run sq key userid add --cert-file key.pgp --name Juliet --email [email protected] --output new.pgp |
| 500 |
when I run sq inspect new.pgp |
| 501 |
then stdout contains "UserID: Juliet" |
| 502 |
then stdout contains "UserID: <[email protected]>" |
| 503 |
~~~ |
| 504 |
|
| 505 |
|
| 506 |
## Certificate extraction: `sq key delete` |
| 507 |
|
| 508 |
This section covers extraction of certificates from keys: the `sq |
| 509 |
key delete` subcommand and its variations. |
| 510 |
|
| 511 |
|
| 512 |
### Extract certificate to the standard output |
| 513 |
|
| 514 |
_Requirement: We must be able to extract a certificate to standard |
| 515 |
output._ |
| 516 |
|
| 517 |
~~~scenario |
| 518 |
given an installed sq |
| 519 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev |
| 520 |
when I run sq key delete --cert-file key.pgp --output - |
| 521 |
then stdout contains "-----BEGIN PGP PUBLIC KEY BLOCK-----" |
| 522 |
then stdout contains "-----END PGP PUBLIC KEY BLOCK-----" |
| 523 |
~~~ |
| 524 |
|
| 525 |
|
| 526 |
### Extract certificate to a file |
| 527 |
|
| 528 |
_Requirement: We must be able to extract a certificate to a named |
| 529 |
file._ |
| 530 |
|
| 531 |
~~~scenario |
| 532 |
given an installed sq |
| 533 |
when I run sq key generate --own-key --without-password --output key.pgp --rev-cert key.pgp.rev --userid Alice |
| 534 |
when I run sq key delete --cert-file key.pgp --output cert.pgp |
| 535 |
when I run sq inspect cert.pgp |
| 536 |
then stdout contains "OpenPGP Certificate." |
| 537 |
then stdout contains "Alice" |
| 538 |
~~~ |
| 539 |
|
| 540 |
|
| 541 |
# Keyring management: `sq keyring` |
| 542 |
|
| 543 |
This chapter verifies that the various subcommands to manage keyring |
| 544 |
files work: subcommands of the `sq keyring` command. |
| 545 |
|
| 546 |
## Joining keys into a keyring: `sq keyring merge` |
| 547 |
|
| 548 |
The scenarios in this section verify that various ways of joining keys |
| 549 |
into a keyring work. |
| 550 |
|
| 551 |
### Join two keys into a textual keyring to stdout |
| 552 |
|
| 553 |
_Requirement: we can join two keys into a keyring, and have it written |
| 554 |
to stdout._ |
| 555 |
|
| 556 |
This is for secret keys, with the output going to stdout in text form. |
| 557 |
|
| 558 |
~~~scenario |
| 559 |
given an installed sq |
| 560 |
when I run sq key generate --own-key --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev |
| 561 |
when I run sq key generate --own-key --without-password --userid Bob --output bob.pgp --rev-cert bob.pgp.rev |
| 562 |
when I run sq keyring merge alice.pgp bob.pgp --output ring.pgp |
| 563 |
when I run sq keyring list ring.pgp |
| 564 |
then stdout contains "Alice" |
| 565 |
then stdout contains "Bob" |
| 566 |
~~~ |
| 567 |
|
| 568 |
### Join two keys into a textual keyring to a named file |
| 569 |
|
| 570 |
_Requirement: we can join two keys into a keyring, and have it written |
| 571 |
to a named file._ |
| 572 |
|
| 573 |
This is for secret keys, with the output going to a file in text form. |
| 574 |
|
| 575 |
~~~scenario |
| 576 |
given an installed sq |
| 577 |
when I run sq key generate --own-key --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev |
| 578 |
when I run sq key generate --own-key --without-password --userid Bob --output bob.pgp --rev-cert bob.pgp.rev |
| 579 |
when I run sq keyring merge alice.pgp bob.pgp --output ring.pgp |
| 580 |
then file ring.pgp contains "-----BEGIN PGP PRIVATE KEY BLOCK-----" |
| 581 |
then file ring.pgp contains "-----END PGP PRIVATE KEY BLOCK-----" |
| 582 |
when I run sq inspect ring.pgp |
| 583 |
then stdout contains "Transferable Secret Key." |
| 584 |
then stdout contains "Alice" |
| 585 |
then stdout contains "Bob" |
| 586 |
~~~ |
| 587 |
|
| 588 |
### Join two keys into a keyring |
| 589 |
|
| 590 |
_Requirement: we can join two keys into a keyring form._ |
| 591 |
|
| 592 |
~~~scenario |
| 593 |
given an installed sq |
| 594 |
when I run sq key generate --own-key --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev |
| 595 |
when I run sq key generate --own-key --without-password --userid Bob --output bob.pgp --rev-cert bob.pgp.rev |
| 596 |
when I run sq keyring merge alice.pgp bob.pgp --output ring.pgp |
| 597 |
when I run sq inspect ring.pgp |
| 598 |
then stdout contains "Transferable Secret Key." |
| 599 |
then stdout contains "Alice" |
| 600 |
then stdout contains "Bob" |
| 601 |
~~~ |
| 602 |
|
| 603 |
### Join two certificates into a keyring |
| 604 |
|
| 605 |
_Requirement: we can join two certificates into a keyring._ |
| 606 |
|
| 607 |
This scenario writes the keyring to a named file. We assume the |
| 608 |
writing operation is independent of the types of items in the keyring, |
| 609 |
so we don't change writing to stdout separately. |
| 610 |
|
| 611 |
~~~scenario |
| 612 |
given an installed sq |
| 613 |
when I run sq key generate --own-key --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev |
| 614 |
when I run sq key generate --own-key --without-password --userid Bob --output bob.pgp --rev-cert bob.pgp.rev |
| 615 |
when I run sq key delete --cert-file alice.pgp --output alice-cert.pgp |
| 616 |
when I run sq key delete --cert-file bob.pgp --output bob-cert.pgp |
| 617 |
when I run sq keyring merge alice-cert.pgp bob-cert.pgp --output ring.pgp |
| 618 |
when I run cat ring.pgp |
| 619 |
then stdout contains "-----BEGIN PGP PUBLIC KEY BLOCK-----" |
| 620 |
then stdout contains "-----END PGP PUBLIC KEY BLOCK-----" |
| 621 |
when I run sq inspect ring.pgp |
| 622 |
then stdout doesn't contain "Transferable Secret Key." |
| 623 |
then stdout contains "OpenPGP Certificate." |
| 624 |
then stdout contains "Alice" |
| 625 |
then stdout contains "Bob" |
| 626 |
~~~ |
| 627 |
|
| 628 |
|
| 629 |
## Filter a keyring: `sq keyring filter` |
| 630 |
|
| 631 |
The scenarios in this section verify that various ways of filtering |
| 632 |
the contents of a keyring work: the `sq keyring filter` subcommand |
| 633 |
variants. |
| 634 |
|
| 635 |
|
| 636 |
### We can extract only certificates to named file |
| 637 |
|
| 638 |
_Requirement: we can remove private keys from a keyring, leaving only |
| 639 |
certificates._ |
| 640 |
|
| 641 |
~~~scenario |
| 642 |
given an installed sq |
| 643 |
when I run sq key generate --own-key --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev |
| 644 |
when I run sq key generate --own-key --without-password --userid Bob --output bob.pgp --rev-cert bob.pgp.rev |
| 645 |
when I run sq keyring merge alice.pgp bob.pgp --output ring.pgp |
| 646 |
when I run sq keyring filter --experimental --to-cert ring.pgp --output filtered.pgp |
| 647 |
when I run sq inspect filtered.pgp |
| 648 |
then stdout contains "OpenPGP Certificate." |
| 649 |
then stdout doesn't contain "Transferable Secret Key." |
| 650 |
then stdout contains "Alice" |
| 651 |
then stdout contains "Bob" |
| 652 |
~~~ |
| 653 |
|
| 654 |
### We can filter to stdout |
| 655 |
|
| 656 |
_Requirement: we can get filter output to stdout instead of a named |
| 657 |
file._ |
| 658 |
|
| 659 |
~~~scenario |
| 660 |
given an installed sq |
| 661 |
when I run sq key generate --own-key --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev |
| 662 |
when I run sq key generate --own-key --without-password --userid Bob --output bob.pgp --rev-cert bob.pgp.rev |
| 663 |
when I run sq keyring merge alice.pgp bob.pgp --output ring.pgp |
| 664 |
when I run sq keyring filter --experimental --to-cert ring.pgp |
| 665 |
then stdout contains "-----BEGIN PGP PUBLIC KEY BLOCK-----" |
| 666 |
then stdout contains "-----END PGP PUBLIC KEY BLOCK-----" |
| 667 |
~~~ |
| 668 |
|
| 669 |
### We can keep only matching certificates |
| 670 |
|
| 671 |
_Requirement: we can remove certificates that don't match filter |
| 672 |
criteria._ |
| 673 |
|
| 674 |
~~~scenario |
| 675 |
given an installed sq |
| 676 |
when I run sq key generate --own-key --without-password --userid Alice --userid Bob --output alice.pgp --rev-cert alice.pgp.rev |
| 677 |
when I run sq keyring filter --experimental --prune-certs --name Alice alice.pgp --output filtered.pgp |
| 678 |
when I run sq inspect filtered.pgp |
| 679 |
then stdout contains "Alice" |
| 680 |
then stdout doesn't contain "Bob" |
| 681 |
~~~ |
| 682 |
|
| 683 |
### We can filter for specific user id |
| 684 |
|
| 685 |
_Requirement: we can extract only keys and certificates with a |
| 686 |
specific user id._ |
| 687 |
|
| 688 |
~~~scenario |
| 689 |
given an installed sq |
| 690 |
when I run sq key generate --own-key --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev |
| 691 |
when I run sq key generate --own-key --without-password --userid Bob --output bob.pgp --rev-cert bob.pgp.rev |
| 692 |
when I run sq keyring merge alice.pgp bob.pgp --output ring.pgp |
| 693 |
when I run sq keyring filter --experimental --userid Alice ring.pgp --output filtered.pgp |
| 694 |
when I run sq inspect filtered.pgp |
| 695 |
then stdout contains "Alice" |
| 696 |
then stdout doesn't contain "Bob" |
| 697 |
~~~ |
| 698 |
|
| 699 |
### We can filter for any of several user ids |
| 700 |
|
| 701 |
_Requirement: we can extract only keys and certificates with any of |
| 702 |
specific user ids._ |
| 703 |
|
| 704 |
~~~scenario |
| 705 |
given an installed sq |
| 706 |
when I run sq key generate --own-key --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev |
| 707 |
when I run sq key generate --own-key --without-password --userid Bob --output bob.pgp --rev-cert bob.pgp.rev |
| 708 |
when I run sq keyring merge alice.pgp bob.pgp --output ring.pgp |
| 709 |
when I run sq keyring filter --experimental --userid Alice --userid Bob ring.pgp --output filtered.pgp |
| 710 |
when I run sq inspect filtered.pgp |
| 711 |
then stdout contains "Alice" |
| 712 |
then stdout contains "Bob" |
| 713 |
~~~ |
| 714 |
|
| 715 |
### We can filter for a name |
| 716 |
|
| 717 |
_Requirement: we can extract only keys and certificates with a name as |
| 718 |
part of a user ids._ |
| 719 |
|
| 720 |
~~~scenario |
| 721 |
given an installed sq |
| 722 |
when I run sq key generate --own-key --without-password --userid 'Alice <[email protected]>' --output alice.pgp --rev-cert alice.pgp.rev |
| 723 |
when I run sq key generate --own-key --without-password --userid 'Bob <[email protected]>' --output bob.pgp --rev-cert bob.pgp.rev |
| 724 |
when I run sq keyring merge alice.pgp bob.pgp --output ring.pgp |
| 725 |
when I run sq keyring filter --experimental --name Alice ring.pgp --output filtered.pgp |
| 726 |
when I run sq inspect filtered.pgp |
| 727 |
then stdout contains "Alice" |
| 728 |
then stdout doesn't contain "Bob" |
| 729 |
~~~ |
| 730 |
|
| 731 |
### We can filter for several names |
| 732 |
|
| 733 |
_Requirement: we can extract only keys and certificates with any of |
| 734 |
several names as part of the user id._ |
| 735 |
|
| 736 |
~~~scenario |
| 737 |
given an installed sq |
| 738 |
when I run sq key generate --own-key --without-password --userid 'Alice <[email protected]>' --output alice.pgp --rev-cert alice.pgp.rev |
| 739 |
when I run sq key generate --own-key --without-password --userid 'Bob <[email protected]>' --output bob.pgp --rev-cert bob.pgp.rev |
| 740 |
when I run sq keyring merge alice.pgp bob.pgp --output ring.pgp |
| 741 |
when I run sq keyring filter --experimental --name Alice --name Bob ring.pgp --output filtered.pgp |
| 742 |
when I run sq inspect filtered.pgp |
| 743 |
then stdout contains "Alice" |
| 744 |
then stdout contains "Bob" |
| 745 |
~~~ |
| 746 |
|
| 747 |
### We can filter for a domain |
| 748 |
|
| 749 |
_Requirement: we can extract only keys and certificates with a name as |
| 750 |
part of a user ids._ |
| 751 |
|
| 752 |
~~~scenario |
| 753 |
given an installed sq |
| 754 |
when I run sq key generate --own-key --without-password --userid 'Alice <[email protected]>' --output alice.pgp --rev-cert alice.pgp.rev |
| 755 |
when I run sq key generate --own-key --without-password --userid 'Bob <[email protected]>' --output bob.pgp --rev-cert bob.pgp.rev |
| 756 |
when I run sq keyring merge alice.pgp bob.pgp --output ring.pgp |
| 757 |
when I run sq keyring filter --experimental --domain example.com ring.pgp --output filtered.pgp |
| 758 |
when I run sq inspect filtered.pgp |
| 759 |
then stdout contains "Alice" |
| 760 |
then stdout doesn't contain "Bob" |
| 761 |
~~~ |
| 762 |
|
| 763 |
### We can filter for several domains |
| 764 |
|
| 765 |
_Requirement: we can extract only keys and certificates with any of |
| 766 |
several names as part of the user id._ |
| 767 |
|
| 768 |
~~~scenario |
| 769 |
given an installed sq |
| 770 |
when I run sq key generate --own-key --without-password --userid 'Alice <[email protected]>' --output alice.pgp --rev-cert alice.pgp.rev |
| 771 |
when I run sq key generate --own-key --without-password --userid 'Bob <[email protected]>' --output bob.pgp --rev-cert bob.pgp.rev |
| 772 |
when I run sq keyring merge alice.pgp bob.pgp --output ring.pgp |
| 773 |
when I run sq keyring filter --experimental --domain example.com --domain sequoia-pgp.org ring.pgp --output filtered.pgp |
| 774 |
when I run sq inspect filtered.pgp |
| 775 |
then stdout contains "Alice" |
| 776 |
then stdout contains "Bob" |
| 777 |
~~~ |
| 778 |
|
| 779 |
|
| 780 |
## Listing contents of a keyring: `sq keyring list` |
| 781 |
|
| 782 |
The scenarios in this section verify the contents of a keyring can be listed. |
| 783 |
|
| 784 |
### List keys in a keyring |
| 785 |
|
| 786 |
_Requirement: we can list the keys in a keyring._ |
| 787 |
|
| 788 |
~~~scenario |
| 789 |
given an installed sq |
| 790 |
when I run sq key generate --own-key --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev |
| 791 |
when I run sq key generate --own-key --without-password --userid Bob --output bob.pgp --rev-cert bob.pgp.rev |
| 792 |
when I run sq keyring merge alice.pgp bob.pgp --output ring.pgp |
| 793 |
when I run sq keyring list ring.pgp |
| 794 |
then stdout contains "Alice" |
| 795 |
then stdout contains "Bob" |
| 796 |
~~~ |
| 797 |
|
| 798 |
### List keys in a key file |
| 799 |
|
| 800 |
_Requirement: we can list the keys in a key file._ |
| 801 |
|
| 802 |
~~~scenario |
| 803 |
given an installed sq |
| 804 |
when I run sq key generate --own-key --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev |
| 805 |
when I run sq keyring list alice.pgp |
| 806 |
then stdout contains "Alice" |
| 807 |
then stdout doesn't contain "Bob" |
| 808 |
~~~ |
| 809 |
|
| 810 |
### List all user ids in a key file |
| 811 |
|
| 812 |
_Requirement: we can list all user ids._ |
| 813 |
|
| 814 |
~~~scenario |
| 815 |
given an installed sq |
| 816 |
when I run sq key generate --own-key --without-password --userid Alice --userid Bob --output alice.pgp --rev-cert alice.pgp.rev |
| 817 |
when I run sq keyring list alice.pgp --all-userids |
| 818 |
then stdout contains "Alice" |
| 819 |
then stdout contains "Bob" |
| 820 |
~~~ |
| 821 |
|
| 822 |
### List keys in keyring read from stdin |
| 823 |
|
| 824 |
_Requirement: we can list keys in a keyring that we read from stdin._ |
| 825 |
|
| 826 |
This isn't implemented yet, because Subplot needs to add support for |
| 827 |
redirecting stdin to come from a file first. |
| 828 |
|
| 829 |
|
| 830 |
|
| 831 |
## Split a keyring: `sq keyring split` |
| 832 |
|
| 833 |
The scenarios in this section verify that splitting a keyring into |
| 834 |
individual files, one per key: the `sq keyring split` subcommand. |
| 835 |
|
| 836 |
Or rather, there will be such scenarios here when Subplot provides |
| 837 |
tools for dealing with randomly named files. Until then, this section |
| 838 |
is a placeholder. |
| 839 |
|
| 840 |
~~~ |
| 841 |
given an installed sq |
| 842 |
when I run sq key generate --own-key --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev |
| 843 |
when I run sq key generate --own-key --without-password --userid Bob --output bob.pgp --rev-cert bob.pgp.rev |
| 844 |
when I run sq keyring merge alice.pgp bob.pgp --output ring.pgp |
| 845 |
when I run sq keyring split ring.pgp |
| 846 |
then the resulting files match alice,pgp and bob.pgp |
| 847 |
~~~ |
| 848 |
|
| 849 |
# Encryption and decryption: `sq encrypt` and `sq decrypt` |
| 850 |
|
| 851 |
This chapter has scenarios for verifying that encryption and |
| 852 |
decryption work. The overall approach is to do round trips: we |
| 853 |
encrypt, then decrypt, and is the result is identical to the input, |
| 854 |
all good. |
| 855 |
|
| 856 |
## Encrypt to stdout as ASCII armored |
| 857 |
|
| 858 |
_Requirement: We must be able to encrypt a file using a certificate, |
| 859 |
with output going to stdout. |
| 860 |
|
| 861 |
We also verify that the encrypted output doesn't contain the message |
| 862 |
in cleartext, just in case. |
| 863 |
|
| 864 |
~~~scenario |
| 865 |
given an installed sq |
| 866 |
given file hello.txt |
| 867 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev |
| 868 |
when I run sq key delete --cert-file key.pgp --output cert.pgp |
| 869 |
when I run sq encrypt --without-signature --for-file cert.pgp hello.txt |
| 870 |
then stdout contains "-----BEGIN PGP MESSAGE-----" |
| 871 |
then stdout doesn't contain "hello, world" |
| 872 |
~~~ |
| 873 |
|
| 874 |
|
| 875 |
## Encrypt to stdout as binary |
| 876 |
|
| 877 |
_Requirement: We must be able to encrypt a file using a certificate, |
| 878 |
with output going to stdout. |
| 879 |
|
| 880 |
We also verify that the encrypted output doesn't contain the message |
| 881 |
in cleartext, just in case. |
| 882 |
|
| 883 |
~~~scenario |
| 884 |
given an installed sq |
| 885 |
given file hello.txt |
| 886 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev |
| 887 |
when I run sq key delete --cert-file key.pgp --output cert.pgp |
| 888 |
when I run sq encrypt --without-signature --binary --for-file cert.pgp hello.txt |
| 889 |
then stdout doesn't contain "-----BEGIN PGP MESSAGE-----" |
| 890 |
then stdout doesn't contain "hello, world" |
| 891 |
~~~ |
| 892 |
|
| 893 |
|
| 894 |
## Encrypt and decrypt using asymmetric encryption |
| 895 |
|
| 896 |
_Requirement: We must be able to encrypt a file using a certificate, |
| 897 |
and then decrypt it using the corresponding key._ |
| 898 |
|
| 899 |
This scenario creates a plain text file, generates a key, encrypts and |
| 900 |
then decrypts the file. The resulting output must be identical to the |
| 901 |
original plain text input file. This is a very simplistic scenario and |
| 902 |
does not even try to test harder cases (binary files, very large |
| 903 |
files, etc). |
| 904 |
|
| 905 |
~~~scenario |
| 906 |
given an installed sq |
| 907 |
given file hello.txt |
| 908 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev |
| 909 |
when I run sq key delete --cert-file key.pgp --output cert.pgp |
| 910 |
when I run sq encrypt --without-signature --output x.pgp --for-file cert.pgp hello.txt |
| 911 |
when I run sq decrypt --output output.txt --recipient-file key.pgp x.pgp |
| 912 |
then files hello.txt and output.txt match |
| 913 |
~~~ |
| 914 |
|
| 915 |
|
| 916 |
## Encrypt for multiple recipients |
| 917 |
|
| 918 |
_Requirement: We must be able to encrypt a message for multiple |
| 919 |
recipients at a time._ |
| 920 |
|
| 921 |
~~~scenario |
| 922 |
given an installed sq |
| 923 |
given file hello.txt |
| 924 |
when I run sq key generate --own-key --without-password --no-userids --output alice.pgp --rev-cert alice.pgp.rev |
| 925 |
when I run sq key delete --cert-file alice.pgp --output alice-cert.pgp |
| 926 |
when I run sq key generate --own-key --without-password --no-userids --output bob.pgp --rev-cert bob.pgp.rev |
| 927 |
when I run sq key delete --cert-file bob.pgp --output bob-cert.pgp |
| 928 |
|
| 929 |
when I run sq encrypt --without-signature --for-file alice-cert.pgp --for-file bob-cert.pgp hello.txt --output x.pgp |
| 930 |
|
| 931 |
when I run sq decrypt --recipient-file alice.pgp --output alice.txt x.pgp |
| 932 |
then files hello.txt and alice.txt match |
| 933 |
|
| 934 |
when I run sq decrypt --recipient-file bob.pgp --output bob.txt x.pgp |
| 935 |
then files hello.txt and bob.txt match |
| 936 |
~~~ |
| 937 |
|
| 938 |
|
| 939 |
## Encrypt and sign at the same time |
| 940 |
|
| 941 |
_Requirement: We must be able to sign and encrypt a message at the |
| 942 |
same time._ |
| 943 |
|
| 944 |
~~~scenario |
| 945 |
given an installed sq |
| 946 |
given file hello.txt |
| 947 |
when I run sq key generate --own-key --without-password --no-userids --output alice.pgp --rev-cert alice.pgp.rev |
| 948 |
when I run sq key delete --cert-file alice.pgp --output alice-cert.pgp |
| 949 |
|
| 950 |
when I run sq encrypt --for-file alice-cert.pgp --signer-file alice.pgp hello.txt --output x.pgp |
| 951 |
|
| 952 |
when I run sq decrypt --recipient-file alice.pgp --output alice.txt x.pgp --signer-file alice-cert.pgp |
| 953 |
then files hello.txt and alice.txt match |
| 954 |
~~~ |
| 955 |
|
| 956 |
|
| 957 |
## Detect bad signature when decrypting |
| 958 |
|
| 959 |
_Requirement: When decrypting a message, if a signature check fails, |
| 960 |
the output file should be deleted. |
| 961 |
|
| 962 |
~~~scenario |
| 963 |
given an installed sq |
| 964 |
given file hello.txt |
| 965 |
given file empty |
| 966 |
when I run sq key generate --own-key --without-password --no-userids --output alice.pgp --rev-cert alice.pgp.rev |
| 967 |
when I run sq key delete --cert-file alice.pgp --output alice-cert.pgp |
| 968 |
when I run sq key generate --own-key --without-password --no-userids --output bob.pgp --rev-cert bob.pgp.rev |
| 969 |
when I run sq key delete --cert-file bob.pgp --output bob-cert.pgp |
| 970 |
|
| 971 |
when I run sq encrypt --for-file alice-cert.pgp --signer-file alice.pgp hello.txt --output x.pgp |
| 972 |
|
| 973 |
when I try to run sq decrypt --recipient-file alice.pgp --output alice.txt x.pgp --signer-file bob-cert.pgp |
| 974 |
then exit code is 1 |
| 975 |
then file alice.txt does not exist |
| 976 |
~~~ |
| 977 |
|
| 978 |
|
| 979 |
|
| 980 |
|
| 981 |
# Certify user identities: `sq pki vouch add` |
| 982 |
|
| 983 |
The scenarios in this chapter verify the certification functionality: |
| 984 |
the subcommand `sq certify` in its various variations. |
| 985 |
|
| 986 |
## Certify an identity as ASCII armor |
| 987 |
|
| 988 |
_Requirement: We can certify a user identity on a key._ |
| 989 |
|
| 990 |
~~~scenario |
| 991 |
given an installed sq |
| 992 |
when I run sq key generate --own-key --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev |
| 993 |
when I run sq key delete --cert-file alice.pgp --output alice-cert.pgp |
| 994 |
when I run sq key generate --own-key --without-password --userid Bob --output bob.pgp --rev-cert bob.pgp.rev |
| 995 |
when I run sq key delete --cert-file bob.pgp --output bob-cert.pgp |
| 996 |
|
| 997 |
when I run sq inspect bob-cert.pgp |
| 998 |
then stdout doesn't contain "Certifications:" |
| 999 |
|
| 1000 |
when I run sq pki vouch add --certifier-file alice.pgp --cert-file bob-cert.pgp --userid Bob --output cert.pgp |
| 1001 |
then file cert.pgp contains "-----BEGIN PGP PUBLIC KEY BLOCK-----" |
| 1002 |
then file cert.pgp contains "-----END PGP PUBLIC KEY BLOCK-----" |
| 1003 |
when I run sq inspect cert.pgp |
| 1004 |
then stdout contains "Certifications: 1," |
| 1005 |
~~~ |
| 1006 |
|
| 1007 |
## Certify an identity |
| 1008 |
|
| 1009 |
_Requirement: We can certify a user identity on a key._ |
| 1010 |
|
| 1011 |
~~~scenario |
| 1012 |
given an installed sq |
| 1013 |
when I run sq key generate --own-key --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev |
| 1014 |
when I run sq key delete --cert-file alice.pgp --output alice-cert.pgp |
| 1015 |
when I run sq key generate --own-key --without-password --userid Bob --output bob.pgp --rev-cert bob.pgp.rev |
| 1016 |
when I run sq key delete --cert-file bob.pgp --output bob-cert.pgp |
| 1017 |
|
| 1018 |
when I run sq inspect bob-cert.pgp |
| 1019 |
then stdout doesn't contain "Certifications:" |
| 1020 |
|
| 1021 |
when I run sq pki vouch add --certifier-file alice.pgp --cert-file bob-cert.pgp --userid Bob --output cert.pgp |
| 1022 |
when I run sq inspect cert.pgp |
| 1023 |
then stdout contains "Certifications: 1," |
| 1024 |
~~~ |
| 1025 |
|
| 1026 |
## Certify an identity matched by email address |
| 1027 |
|
| 1028 |
_Requirement: We can certify a user identity on a cert identified by |
| 1029 |
email address._ |
| 1030 |
|
| 1031 |
~~~scenario |
| 1032 |
given an installed sq |
| 1033 |
when I run sq key generate --own-key --without-password --userid "<[email protected]>" --output alice.pgp --rev-cert alice.pgp.rev |
| 1034 |
when I run sq key delete --cert-file alice.pgp --output alice-cert.pgp |
| 1035 |
when I run sq key generate --own-key --without-password --userid "<[email protected]>" --output bob.pgp --rev-cert bob.pgp.rev |
| 1036 |
when I run sq key delete --cert-file bob.pgp --output bob-cert.pgp |
| 1037 |
|
| 1038 |
when I run sq pki vouch add --certifier-file alice.pgp --cert-file bob-cert.pgp --email [email protected] --output cert.pgp |
| 1039 |
when I run sq inspect cert.pgp |
| 1040 |
then stdout contains "Certifications: 1," |
| 1041 |
~~~ |
| 1042 |
|
| 1043 |
## Certify an identity that is not self-signed |
| 1044 |
|
| 1045 |
_Requirement: We can certify a user identity on a cert, even if that |
| 1046 |
user identity doesn't exist on that cert, and consequently has no |
| 1047 |
self-signature._ |
| 1048 |
|
| 1049 |
~~~scenario |
| 1050 |
given an installed sq |
| 1051 |
when I run sq key generate --own-key --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev |
| 1052 |
when I run sq key delete --cert-file alice.pgp --output alice-cert.pgp |
| 1053 |
when I run sq key generate --own-key --without-password --userid Bob --output bob.pgp --rev-cert bob.pgp.rev |
| 1054 |
when I run sq key delete --cert-file bob.pgp --output bob-cert.pgp |
| 1055 |
|
| 1056 |
when I run sq inspect bob-cert.pgp |
| 1057 |
then stdout doesn't contain "Certifications:" |
| 1058 |
|
| 1059 |
when I run sq pki vouch add --certifier-file alice.pgp --cert-file bob-cert.pgp --add-userid "My friend Bob" --output cert.pgp |
| 1060 |
when I run sq inspect cert.pgp |
| 1061 |
then stdout contains "My friend Bob" |
| 1062 |
then stdout contains "Certifications: 1," |
| 1063 |
~~~ |
| 1064 |
|
| 1065 |
## Certify an email identity that is not self-signed |
| 1066 |
|
| 1067 |
_Requirement: We can certify an email on a cert, even if that |
| 1068 |
email address doesn't exist on that cert, and consequently has no |
| 1069 |
self-signature._ |
| 1070 |
|
| 1071 |
~~~scenario |
| 1072 |
given an installed sq |
| 1073 |
when I run sq key generate --own-key --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev |
| 1074 |
when I run sq key delete --cert-file alice.pgp --output alice-cert.pgp |
| 1075 |
when I run sq key generate --own-key --without-password --userid Bob --output bob.pgp --rev-cert bob.pgp.rev |
| 1076 |
when I run sq key delete --cert-file bob.pgp --output bob-cert.pgp |
| 1077 |
|
| 1078 |
when I run sq pki vouch add --certifier-file alice.pgp --cert-file bob-cert.pgp --add-email "[email protected]" --output cert.pgp |
| 1079 |
when I run sq inspect cert.pgp |
| 1080 |
then stdout contains "<[email protected]>" |
| 1081 |
then stdout contains "Certifications: 1," |
| 1082 |
~~~ |
| 1083 |
|
| 1084 |
|
| 1085 |
# Sign a document and verify the signature: `sq sign` and `sq verify` |
| 1086 |
|
| 1087 |
This chapter verifies that digital signatures work in `sq`. Like with |
| 1088 |
encryption, the verification is based on round trips: we create a |
| 1089 |
signature, and that it matches the signed data. We break this into a |
| 1090 |
number simple cases. |
| 1091 |
|
| 1092 |
## Create signature to stdout in ASCII armor |
| 1093 |
|
| 1094 |
_Requirement: We can create a signature and have it written to |
| 1095 |
stdout in ASCII armor form._ |
| 1096 |
|
| 1097 |
~~~scenario |
| 1098 |
given an installed sq |
| 1099 |
given file hello.txt |
| 1100 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev |
| 1101 |
when I run sq sign --message --signer-file key.pgp hello.txt |
| 1102 |
then stdout contains "-----BEGIN PGP MESSAGE-----" |
| 1103 |
then stdout contains "-----END PGP MESSAGE-----" |
| 1104 |
~~~ |
| 1105 |
|
| 1106 |
## Create signature to stdout in binary |
| 1107 |
|
| 1108 |
_Requirement: We can create a signature and have it written to |
| 1109 |
stdout in binary form._ |
| 1110 |
|
| 1111 |
~~~scenario |
| 1112 |
given an installed sq |
| 1113 |
given file hello.txt |
| 1114 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev |
| 1115 |
when I run sq sign --message --signer-file key.pgp --binary hello.txt |
| 1116 |
then stdout doesn't contain "-----BEGIN PGP MESSAGE-----" |
| 1117 |
then stdout doesn't contain "-----END PGP MESSAGE-----" |
| 1118 |
~~~ |
| 1119 |
|
| 1120 |
## Create signature to named file |
| 1121 |
|
| 1122 |
_Requirement: We can create a signature and have it written to a named |
| 1123 |
file._ |
| 1124 |
|
| 1125 |
~~~scenario |
| 1126 |
given an installed sq |
| 1127 |
given file hello.txt |
| 1128 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev |
| 1129 |
when I run sq sign --message --signer-file key.pgp --output signed.pgp hello.txt |
| 1130 |
then file signed.pgp contains "-----BEGIN PGP MESSAGE-----" |
| 1131 |
then file signed.pgp contains "-----END PGP MESSAGE-----" |
| 1132 |
~~~ |
| 1133 |
|
| 1134 |
## Signed file can be verified |
| 1135 |
|
| 1136 |
_Requirement: We can sign a file and verify the signature._ |
| 1137 |
|
| 1138 |
~~~scenario |
| 1139 |
given an installed sq |
| 1140 |
given file hello.txt |
| 1141 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev |
| 1142 |
when I run sq key delete --cert-file key.pgp --output cert.pgp |
| 1143 |
when I run sq sign --message --signer-file key.pgp --output signed.pgp hello.txt |
| 1144 |
when I run sq verify --message --signer-file cert.pgp signed.pgp |
| 1145 |
then stdout contains "hello, world" |
| 1146 |
~~~ |
| 1147 |
|
| 1148 |
## File is signed with all required keys |
| 1149 |
|
| 1150 |
_Requirement: We can verify that a file is signed by all required |
| 1151 |
keys._ |
| 1152 |
|
| 1153 |
We verify this by signing a file twice, and verifying there are two |
| 1154 |
signatures. We also verify that if there is only one signature, it's |
| 1155 |
not enough, when we need two. |
| 1156 |
|
| 1157 |
~~~scenario |
| 1158 |
given an installed sq |
| 1159 |
given file hello.txt |
| 1160 |
when I run sq key generate --own-key --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev |
| 1161 |
when I run sq key delete --cert-file alice.pgp --output alice-cert.pgp |
| 1162 |
when I run sq key generate --own-key --without-password --userid Bob --output bob.pgp --rev-cert bob.pgp.rev |
| 1163 |
when I run sq key delete --cert-file bob.pgp --output bob-cert.pgp |
| 1164 |
|
| 1165 |
when I run sq sign --message --signer-file alice.pgp --output signed1.pgp hello.txt |
| 1166 |
when I try to run sq verify --message --signer-file alice-cert.pgp --signer-file bob-cert.pgp --signatures=2 signed1.pgp |
| 1167 |
then exit code is 1 |
| 1168 |
|
| 1169 |
when I run sq sign --message --append --signer-file bob.pgp --output signed2.pgp signed1.pgp |
| 1170 |
when I run sq verify --message --signer-file alice-cert.pgp --signer-file bob-cert.pgp --signatures=1 signed2.pgp |
| 1171 |
then stdout contains "hello, world" |
| 1172 |
when I run sq verify --message --signer-file alice-cert.pgp --signer-file bob-cert.pgp --signatures=2 signed2.pgp |
| 1173 |
then stdout contains "hello, world" |
| 1174 |
~~~ |
| 1175 |
|
| 1176 |
## Signed file cannot be verified if it has been modified |
| 1177 |
|
| 1178 |
_Requirement: We can sign a file and verifying the signature fails if |
| 1179 |
the signed file has been modified._ |
| 1180 |
|
| 1181 |
We modify the signed file by removing the third line of it. The file |
| 1182 |
starts with a line containing "-----BEGIN PGP MESSAGE-----" and then |
| 1183 |
an empty line, and the third line is actual data. If we delete that, |
| 1184 |
the file by definition can't be valid anymore. |
| 1185 |
|
| 1186 |
~~~scenario |
| 1187 |
given an installed sq |
| 1188 |
given file hello.txt |
| 1189 |
given file sed-in-place |
| 1190 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev |
| 1191 |
when I run sq key delete --cert-file key.pgp --output cert.pgp |
| 1192 |
when I run sq sign --message --signer-file key.pgp --output signed.pgp hello.txt |
| 1193 |
when I run sh sed-in-place 3d signed.pgp |
| 1194 |
when I try to run sq verify --message --signer-file cert.pgp signed.pgp |
| 1195 |
then command fails |
| 1196 |
~~~ |
| 1197 |
|
| 1198 |
~~~{#sed-in-place .file .sh} |
| 1199 |
#!/bin/sh |
| 1200 |
|
| 1201 |
set -eu |
| 1202 |
tmp="$(mktemp)" |
| 1203 |
trap 'rm -f "$tmp"' EXIT |
| 1204 |
sed "$1" "$2" > "$tmp" |
| 1205 |
cat "$tmp" > "$2" |
| 1206 |
~~~ |
| 1207 |
|
| 1208 |
## Create cleartext signature |
| 1209 |
|
| 1210 |
_Requirement: We can create a signature such that the signed data is |
| 1211 |
included in a readable form._ |
| 1212 |
|
| 1213 |
~~~scenario |
| 1214 |
given an installed sq |
| 1215 |
given file hello.txt |
| 1216 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev |
| 1217 |
when I run sq key delete --cert-file key.pgp --output cert.pgp |
| 1218 |
|
| 1219 |
when I run sq sign --cleartext --signer-file key.pgp --output signed.txt hello.txt |
| 1220 |
then file signed.txt contains "-----BEGIN PGP SIGNED MESSAGE-----" |
| 1221 |
then file signed.txt contains "hello, world" |
| 1222 |
then file signed.txt contains "-----END PGP SIGNATURE-----" |
| 1223 |
when I run sq verify --cleartext --signer-file cert.pgp signed.txt |
| 1224 |
then stdout contains "hello, world" |
| 1225 |
~~~ |
| 1226 |
|
| 1227 |
|
| 1228 |
## Cleartext signature cannot be verified if it has been modified |
| 1229 |
|
| 1230 |
_Requirement: If a cleartext signature is modified, it can't be |
| 1231 |
verified._ |
| 1232 |
|
| 1233 |
~~~scenario |
| 1234 |
given an installed sq |
| 1235 |
given file hello.txt |
| 1236 |
given file sed-in-place |
| 1237 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev |
| 1238 |
when I run sq key delete --cert-file key.pgp --output cert.pgp |
| 1239 |
|
| 1240 |
when I run sq sign --cleartext --signer-file key.pgp --output signed.txt hello.txt |
| 1241 |
when I run sh sed-in-place s/hello/HELLO/ signed.txt |
| 1242 |
when I try to run sq verify --cleartext --signer-file cert.pgp signed.txt |
| 1243 |
then exit code is 1 |
| 1244 |
~~~ |
| 1245 |
|
| 1246 |
## Create a detached signature |
| 1247 |
|
| 1248 |
_Requirement: We can create a signature that is doesn't include the |
| 1249 |
data it signs._ |
| 1250 |
|
| 1251 |
~~~scenario |
| 1252 |
given an installed sq |
| 1253 |
given file hello.txt |
| 1254 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev |
| 1255 |
when I run sq key delete --cert-file key.pgp --output cert.pgp |
| 1256 |
|
| 1257 |
when I run sq sign --signature-file=hello.txt.sig --signer-file key.pgp hello.txt |
| 1258 |
then file hello.txt.sig contains "-----BEGIN PGP SIGNATURE-----" |
| 1259 |
then file hello.txt.sig contains "-----END PGP SIGNATURE-----" |
| 1260 |
when I run sq verify --signature-file=hello.txt.sig --signer-file=cert.pgp hello.txt |
| 1261 |
then stdout doesn't contain "hello, world" |
| 1262 |
then exit code is 0 |
| 1263 |
~~~ |
| 1264 |
|
| 1265 |
|
| 1266 |
## Detached signature cannot be verified if the data has been modified |
| 1267 |
|
| 1268 |
_Requirement: If the file that is signed using a detached signature is |
| 1269 |
modified, the signature can't be verified._ |
| 1270 |
|
| 1271 |
~~~scenario |
| 1272 |
given an installed sq |
| 1273 |
given file hello.txt |
| 1274 |
given file sed-in-place |
| 1275 |
when I run sq key generate --own-key --without-password --no-userids --output key.pgp --rev-cert key.pgp.rev |
| 1276 |
when I run sq key delete --cert-file key.pgp --output cert.pgp |
| 1277 |
|
| 1278 |
when I run sq sign --signature-file=hello.txt.sig --signer-file key.pgp hello.txt |
| 1279 |
when I run sh sed-in-place s/hello/HELLO/ hello.txt |
| 1280 |
when I try to run sq verify --signature-file=hello.txt.sig --signer-file=cert.pgp hello.txt |
| 1281 |
then exit code is 1 |
| 1282 |
~~~ |
| 1283 |
|
| 1284 |
|
| 1285 |
## Append signature to already signed message |
| 1286 |
|
| 1287 |
_Requirement: We must be able to add a signature to an already signed |
| 1288 |
message._ |
| 1289 |
|
| 1290 |
~~~scenario |
| 1291 |
given an installed sq |
| 1292 |
given file hello.txt |
| 1293 |
when I run sq key generate --own-key --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev |
| 1294 |
when I run sq key delete --cert-file alice.pgp --output alice-cert.pgp |
| 1295 |
when I run sq key generate --own-key --without-password --userid Bob --output bob.pgp --rev-cert bob.pgp.rev |
| 1296 |
when I run sq key delete --cert-file bob.pgp --output bob-cert.pgp |
| 1297 |
|
| 1298 |
when I run sq sign --message --signer-file alice.pgp --output signed1.pgp hello.txt |
| 1299 |
when I run sq sign --message --append --signer-file bob.pgp --output signed2.pgp signed1.pgp |
| 1300 |
when I run sq verify --message signed2.pgp --signer-file alice-cert.pgp --signer-file bob-cert.pgp |
| 1301 |
then stdout contains "hello, world" |
| 1302 |
then stderr matches regex 2.authenticated signatures |
| 1303 |
~~~ |
| 1304 |
|
| 1305 |
## Merge signed files |
| 1306 |
|
| 1307 |
_Requirement: We must be able to merge signatures of a file signed |
| 1308 |
twice separately._ |
| 1309 |
|
| 1310 |
~~~scenario |
| 1311 |
given an installed sq |
| 1312 |
given file hello.txt |
| 1313 |
when I run sq key generate --own-key --without-password --userid Alice --output alice.pgp --rev-cert alice.pgp.rev |
| 1314 |
when I run sq key delete --cert-file alice.pgp --output alice-cert.pgp |
| 1315 |
when I run sq key generate --own-key --without-password --userid Bob --output bob.pgp --rev-cert bob.pgp.rev |
| 1316 |
when I run sq key delete --cert-file bob.pgp --output bob-cert.pgp |
| 1317 |
|
| 1318 |
when I run sq sign --message --signer-file alice.pgp --output signed1.pgp hello.txt |
| 1319 |
when I run sq sign --message --signer-file bob.pgp --output signed2.pgp hello.txt |
| 1320 |
when I run sq sign --message --output merged.pgp --merge=signed2.pgp signed1.pgp |
| 1321 |
when I run sq verify --message --signer-file alice-cert.pgp --signer-file bob-cert.pgp merged.pgp |
| 1322 |
then stdout contains "hello, world" |
| 1323 |
then stderr matches regex 2.authenticated signatures |
| 1324 |
~~~ |
| 1325 |
|
| 1326 |
|
| 1327 |
|
| 1328 |
|
| 1329 |
# ASCII Armor data representation: `sq packet armor` and `sq packet dearmor` |
| 1330 |
|
| 1331 |
The scenarios in this chapter verify that `sq` can convert data into |
| 1332 |
the "ASCII Armor" representation and back. |
| 1333 |
|
| 1334 |
## Convert data file to armored format to stdout |
| 1335 |
|
| 1336 |
_Requirement: We must be able to convert a file to armored format to |
| 1337 |
stdout._ |
| 1338 |
|
| 1339 |
~~~scenario |
| 1340 |
given an installed sq |
| 1341 |
given file hello.txt |
| 1342 |
when I run sq packet armor hello.txt |
| 1343 |
then stdout contains "-----BEGIN PGP ARMORED FILE-----" |
| 1344 |
then stdout contains "-----END PGP ARMORED FILE-----" |
| 1345 |
~~~ |
| 1346 |
|
| 1347 |
## Convert data file to armored format to file |
| 1348 |
|
| 1349 |
_Requirement: We must be able to convert a file to armored format to a |
| 1350 |
named file._ |
| 1351 |
|
| 1352 |
~~~scenario |
| 1353 |
given an installed sq |
| 1354 |
given file hello.txt |
| 1355 |
given file hello.asc |
| 1356 |
when I run sq packet armor hello.txt --output hello.out |
| 1357 |
then files hello.asc and hello.out match |
| 1358 |
~~~ |
| 1359 |
|
| 1360 |
|
| 1361 |
## Convert data file to armored format with desired label |
| 1362 |
|
| 1363 |
_Requirement: We must be able to convert a file to armored format with |
| 1364 |
the label we choose._ |
| 1365 |
|
| 1366 |
~~~scenario |
| 1367 |
given an installed sq |
| 1368 |
given file hello.txt |
| 1369 |
when I run sq packet armor hello.txt --label auto |
| 1370 |
then stdout contains "-----BEGIN PGP ARMORED FILE-----" |
| 1371 |
when I run sq packet armor hello.txt --label message |
| 1372 |
then stdout contains "-----BEGIN PGP MESSAGE-----" |
| 1373 |
when I run sq packet armor hello.txt --label cert |
| 1374 |
then stdout contains "-----BEGIN PGP PUBLIC KEY BLOCK-----" |
| 1375 |
when I run sq packet armor hello.txt --label key |
| 1376 |
then stdout contains "-----BEGIN PGP PRIVATE KEY BLOCK-----" |
| 1377 |
when I run sq packet armor hello.txt --label sig |
| 1378 |
then stdout contains "-----BEGIN PGP SIGNATURE-----" |
| 1379 |
when I run sq packet armor hello.txt --label file |
| 1380 |
then stdout contains "-----BEGIN PGP ARMORED FILE-----" |
| 1381 |
~~~ |
| 1382 |
|
| 1383 |
## Convert data file from armored format to stdout |
| 1384 |
|
| 1385 |
_Requirement: We must be able to convert a file from armored format to |
| 1386 |
stdout._ |
| 1387 |
|
| 1388 |
~~~scenario |
| 1389 |
given an installed sq |
| 1390 |
given file hello.asc |
| 1391 |
when I run sq packet dearmor hello.asc |
| 1392 |
then stdout contains "hello, world" |
| 1393 |
~~~ |
| 1394 |
|
| 1395 |
## Convert data file from armored format to file |
| 1396 |
|
| 1397 |
_Requirement: We must be able to convert a file from armored format to |
| 1398 |
a named file._ |
| 1399 |
|
| 1400 |
~~~scenario |
| 1401 |
given an installed sq |
| 1402 |
given file hello.txt |
| 1403 |
given file hello.asc |
| 1404 |
when I run sq packet dearmor hello.asc --output hello.out |
| 1405 |
then files hello.txt and hello.out match |
| 1406 |
~~~ |
| 1407 |
|
| 1408 |
## Armor round trip |
| 1409 |
|
| 1410 |
_Requirement: We must be able to convert data to armored format and |
| 1411 |
back._ |
| 1412 |
|
| 1413 |
~~~scenario |
| 1414 |
given an installed sq |
| 1415 |
given file hello.txt |
| 1416 |
when I run sq packet armor hello.txt --output hello.tmp |
| 1417 |
when I run sq packet dearmor hello.tmp --output hello.out |
| 1418 |
then files hello.txt and hello.out match |
| 1419 |
~~~ |
| 1420 |
|
| 1421 |
|
| 1422 |
|
| 1423 |
# Web key directory (WKD) support |
| 1424 |
|
| 1425 |
[Web Key Directory]: https://wiki.gnupg.org/WKD |
| 1426 |
[Internet Draft 14 for WKD]: https://www.ietf.org/archive/id/draft-koch-openpgp-webkey-service-14.html |
| 1427 |
|
| 1428 |
[Web Key Directory][] (WKD) specifies how to locate a certificate for |
| 1429 |
a given email address by constructing HTTPS URLs from the email |
| 1430 |
address. It is specified in [Internet Draft 14 for WKD][]. |
| 1431 |
|
| 1432 |
|
| 1433 |
# Test data file |
| 1434 |
|
| 1435 |
We use this file as an input file in the tests. It is a very short |
| 1436 |
file, and a text file, but this is enough for the current set of |
| 1437 |
requirements and scenarios. |
| 1438 |
|
| 1439 |
~~~{#hello.txt .file} |
| 1440 |
hello, world |
| 1441 |
~~~ |
| 1442 |
|
| 1443 |
This is the same content, but in ASCII armored representation. |
| 1444 |
|
| 1445 |
~~~{#hello.asc .file} |
| 1446 |
-----BEGIN PGP ARMORED FILE----- |
| 1447 |
|
| 1448 |
aGVsbG8sIHdvcmxkCg== |
| 1449 |
=FOuc |
| 1450 |
-----END PGP ARMORED FILE----- |
| 1451 |
~~~ |
| 1452 |
|
| 1453 |
This is an empty file. |
| 1454 |
|
| 1455 |
~~~{#empty .file add-newline=no} |
| 1456 |
~~~ |
| 1457 |
|
| 1458 |
This is a file containing a password. |
| 1459 |
|
| 1460 |
~~~{#password.txt .file} |
| 1461 |
hunter2 |
| 1462 |
~~~ |