mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-09-09 18:29:39 +02:00
Add information to SOP READMEs
This commit is contained in:
parent
2e7a21b5b7
commit
fc432901ed
2 changed files with 90 additions and 3 deletions
|
@ -6,7 +6,47 @@ SPDX-License-Identifier: Apache-2.0
|
|||
|
||||
# PGPainless-SOP
|
||||
|
||||
[](https://datatracker.ietf.org/doc/html/draft-dkg-openpgp-stateless-cli-03)
|
||||
[](https://search.maven.org/artifact/org.pgpainless/pgpainless-sop)
|
||||
[](https://pgpainless.org/releases/latest/javadoc/org/pgpainless/sop/package-summary.html)
|
||||
[](https://api.reuse.software/info/github.com/pgpainless/pgpainless)
|
||||
|
||||
Implementation of the Stateless OpenPGP Protocol using PGPainless.
|
||||
|
||||
This module implements `sop-java` using `pgpainless-core`.
|
||||
If your code depends on `sop-java`, this module can be used as a realization of those interfaces.
|
||||
If your code depends on `sop-java`, this module can be used as a realization of those interfaces.
|
||||
|
||||
## Usage Examples
|
||||
```java
|
||||
SOP sop = new SOPImpl();
|
||||
|
||||
// Generate an OpenPGP key
|
||||
byte[] key = sop.generateKey()
|
||||
.userId("Alice <alice@example.org>")
|
||||
.generate()
|
||||
.getBytes();
|
||||
|
||||
// Extract the certificate (public key)
|
||||
byte[] cert = sop.extractCert()
|
||||
.key(key)
|
||||
.getBytes();
|
||||
|
||||
// Encrypt a message
|
||||
byte[] message = ...
|
||||
byte[] encrypted = sop.encrypt()
|
||||
.withCert(cert)
|
||||
.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();
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue