1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-12-22 19:08:00 +01:00

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

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: Reading keys from ASCII armored strings or from binary files is easy:
```java ```java
// Secret Keys
String key = "-----BEGIN PGP PRIVATE KEY BLOCK-----\n"...; String key = "-----BEGIN PGP PRIVATE KEY BLOCK-----\n"...;
PGPSecretKeyRing secretKey = PGPainless.readKeyRing() PGPSecretKeyRing secretKey = PGPainless.readKeyRing()
.secretKeyRing(key); .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: Similarly, keys or certificates can quickly be exported: