Documentation: Add section on reading certificates

This commit is contained in:
Paul Schaub 2023-10-06 12:46:17 +02:00
parent 41dfe71994
commit e7e269d7ce
Signed by: vanitasvitae
GPG Key ID: 62BEE9264BF17311
1 changed files with 6 additions and 0 deletions

View File

@ -50,9 +50,15 @@ There is a very good chance that you can find code examples there that fit your
Reading keys from ASCII armored strings or from binary files is easy:
```java
// Secret Keys
String key = "-----BEGIN PGP PRIVATE KEY BLOCK-----\n"...;
PGPSecretKeyRing secretKey = PGPainless.readKeyRing()
.secretKeyRing(key);
// Certificates (Public Keys)
String cert = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n...";
PGPPublicKeyRing certificate = PGPainless.readKeyRing()
.publicKeyRing(cert);
```
Similarly, keys or certificates can quickly be exported: