mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-09-09 10:19:39 +02:00
Port ConvertKeys example
This commit is contained in:
parent
9204df5343
commit
9894524e33
1 changed files with 4 additions and 4 deletions
|
@ -20,17 +20,17 @@ public class ConvertKeys {
|
|||
*/
|
||||
@Test
|
||||
public void secretKeyToCertificate() {
|
||||
PGPainless api = PGPainless.getInstance();
|
||||
String userId = "alice@wonderland.lit";
|
||||
OpenPGPKey secretKey = PGPainless.generateKeyRing()
|
||||
OpenPGPKey secretKey = api.generateKey()
|
||||
.modernKeyRing(userId);
|
||||
|
||||
// Extract certificate (public key) from secret key
|
||||
OpenPGPCertificate certificate = secretKey.toCertificate();
|
||||
|
||||
|
||||
KeyRingInfo secretKeyInfo = PGPainless.inspectKeyRing(secretKey);
|
||||
KeyRingInfo secretKeyInfo = api.inspect(secretKey);
|
||||
assertTrue(secretKeyInfo.isSecretKey());
|
||||
KeyRingInfo certificateInfo = PGPainless.inspectKeyRing(certificate);
|
||||
KeyRingInfo certificateInfo = api.inspect(certificate);
|
||||
assertFalse(certificateInfo.isSecretKey());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue