1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-06-16 08:34:53 +02:00

Add subpages

This commit is contained in:
Paul Schaub 2022-04-27 18:40:43 +02:00
parent dd0dcc176d
commit d40bd6b6d5
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
3 changed files with 76 additions and 0 deletions

12
sop-java-picocli.md Normal file
View file

@ -0,0 +1,12 @@
# SOP-Java-Picocli
`sop-java-picocli` implements a command line interface for SOP implementations.
## Backend Installation
In order to enable OpenPGP operations, you need to set an implementation of [`sop-java`](sop-java.html):
```java
// static method call prior to execution of the main method
SopCLI.setSopInstance(yourSopImpl);
```
## Usage

54
sop-java.md Normal file
View file

@ -0,0 +1,54 @@
# SOP-Java
The [Stateless OpenPGP Protocol (SOP)](https://datatracker.ietf.org/doc/draft-dkg-openpgp-stateless-cli/) specification defines a straightforward interface for common OpenPGP operations.
The Java library `sop-java` contains abstract interfaces reproducing the SOP API. This enables tight integration of OpenPGP functionality.
The point of defining the SOP protocol as an abstract Java library is to enable consumers to decouple their application from the used OpenPGP backend.
In the example below, replacing the backend would accomplished simply by swapping out the first line.
## Usage Examples
```java
SOP sop = new FooSOP();
// Generate an OpenPGP key
// This needs to be kept secret
byte[] key = sop.generateKey()
.userId("Alice <alice@example.org>")
.generate()
.getBytes();
// Extract the certificate (public key)
// This can be published and shared with others
byte[] cert = sop.extractCert()
.key(key)
.getBytes();
// Encrypt a message
byte[] bobsCert = ...
byte[] message = ...
byte[] encrypted = sop.encrypt()
.withCert(cert)
.withCert(bobsCert)
.signWith(key)
.plaintext(message)
.getBytes();
// Decrypt a message
ByteArrayAndResult<DecryptionResult> messageAndVerifications = sop.decrypt()
.verifyWith(cert)
.withKey(key)
.ciphertext(encrypted)
.toByteArrayAndResult();
byte[] decrypted = messageAndVerifications.getBytes();
// Signature Verifications
DecryptionResult messageInfo = messageAndVerifications.getResult();
List<Verification> signatureVerifications = messageInfo.getVerifications();
```
## Known Implementations
`PGPainless` provides an implementation of the `sop-java` library, named `pgpainless-sop`. Unsurprisingly, this library makes use of `pgpainless-core` to implement `sop-java`.
## CLI
If you need a command line interface for your `sop-java` implementation, see [sop-java-picocli](sop-java-picocli.html).

10
sop.md Normal file
View file

@ -0,0 +1,10 @@
# Stateless OpenPGP Protocol
The [Stateless OpenPGP Protocol (SOP)](https://datatracker.ietf.org/doc/draft-dkg-openpgp-stateless-cli/) specification defines a straightforward interface for commonly used OpenPGP operations.
## Java API
While the aforementioned document specifies a command line interface, shelling out to a CLI is not an ideal way of incorporating functionality into an application.
A dedicated Java API is easier to consume and less error prone.
For that reason, `sop-java` was created as a general definition of such API. `sop-java` itself does not have any dependencies on cryptographic libraries, so it is possible to
## Command Line Application