public class SecretKeyBackupHelper
extends java.lang.Object
| Constructor and Description |
|---|
SecretKeyBackupHelper() |
| Modifier and Type | Method and Description |
|---|---|
static SecretkeyElement |
createSecretkeyElement(byte[] keys,
OpenPgpSecretKeyBackupPassphrase backupCode)
Create a
SecretkeyElement which contains the secret keys which are serialized in keys and is
symmetrically encrypted using the backupCode. |
static SecretkeyElement |
createSecretkeyElement(OpenPgpProvider provider,
org.jxmpp.jid.BareJid owner,
java.util.Set<org.pgpainless.key.OpenPgpV4Fingerprint> fingerprints,
OpenPgpSecretKeyBackupPassphrase backupCode)
Create a
SecretkeyElement which contains the secret keys listed in fingerprints and is encrypted
symmetrically using the backupCode. |
static OpenPgpSecretKeyBackupPassphrase |
generateBackupPassword()
Generate a secure backup code.
|
static org.bouncycastle.openpgp.PGPSecretKeyRing |
restoreSecretKeyBackup(SecretkeyElement backup,
OpenPgpSecretKeyBackupPassphrase backupCode)
Decrypt a secret key backup and return the
PGPSecretKeyRing contained in it. |
public static OpenPgpSecretKeyBackupPassphrase generateBackupPassword()
public static SecretkeyElement createSecretkeyElement(OpenPgpProvider provider, org.jxmpp.jid.BareJid owner, java.util.Set<org.pgpainless.key.OpenPgpV4Fingerprint> fingerprints, OpenPgpSecretKeyBackupPassphrase backupCode) throws org.bouncycastle.openpgp.PGPException, java.io.IOException, MissingOpenPgpKeyException
SecretkeyElement which contains the secret keys listed in fingerprints and is encrypted
symmetrically using the backupCode.provider - OpenPgpProvider for symmetric encryption.owner - owner of the secret keys (usually our jid).fingerprints - set of OpenPgpV4Fingerprints of the keys which are going to be backed up.backupCode - passphrase for symmetric encryption.SecretkeyElementorg.bouncycastle.openpgp.PGPException - PGP is brittlejava.io.IOException - IO is dangerousMissingOpenPgpKeyException - in case one of the keys whose fingerprint is in fingerprints is
not accessible.public static SecretkeyElement createSecretkeyElement(byte[] keys, OpenPgpSecretKeyBackupPassphrase backupCode) throws org.bouncycastle.openpgp.PGPException, java.io.IOException
SecretkeyElement which contains the secret keys which are serialized in keys and is
symmetrically encrypted using the backupCode.keys - serialized OpenPGP secret keys in transferable key formatbackupCode - passphrase for symmetric encryptionSecretkeyElementorg.bouncycastle.openpgp.PGPException - PGP is brittlejava.io.IOException - IO is dangerouspublic static org.bouncycastle.openpgp.PGPSecretKeyRing restoreSecretKeyBackup(SecretkeyElement backup, OpenPgpSecretKeyBackupPassphrase backupCode) throws InvalidBackupCodeException, java.io.IOException, org.bouncycastle.openpgp.PGPException
PGPSecretKeyRing contained in it.
TODO: Return a PGPSecretKeyRingCollection instead?backup - encrypted SecretkeyElement containing the backupbackupCode - passphrase for decrypting the SecretkeyElement.InvalidBackupCodeException - in case the provided backup code is invalid.java.io.IOException - IO is dangerous.org.bouncycastle.openpgp.PGPException - PGP is brittle.