1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-19 02:42:05 +01:00

Kotlin conversion: UnprotectedKeysProtector

This commit is contained in:
Paul Schaub 2023-08-31 17:28:08 +02:00
parent a8bc929f24
commit b125333c89
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
2 changed files with 15 additions and 33 deletions

View file

@ -1,33 +0,0 @@
// SPDX-FileCopyrightText: 2018 Paul Schaub <vanitasvitae@fsfe.org>
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.key.protection;
import javax.annotation.Nullable;
import org.bouncycastle.openpgp.operator.PBESecretKeyDecryptor;
import org.bouncycastle.openpgp.operator.PBESecretKeyEncryptor;
/**
* Implementation of the {@link SecretKeyRingProtector} which assumes that all handled keys are not password protected.
*/
public class UnprotectedKeysProtector implements SecretKeyRingProtector {
@Override
public boolean hasPassphraseFor(long keyId) {
return true;
}
@Override
@Nullable
public PBESecretKeyDecryptor getDecryptor(long keyId) {
return null;
}
@Override
@Nullable
public PBESecretKeyEncryptor getEncryptor(long keyId) {
return null;
}
}

View file

@ -0,0 +1,15 @@
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.key.protection
/**
* Implementation of the [SecretKeyRingProtector] which assumes that all handled keys are not password protected.
*/
class UnprotectedKeysProtector : SecretKeyRingProtector {
override fun hasPassphraseFor(keyId: Long) = true
override fun getDecryptor(keyId: Long) = null
override fun getEncryptor(keyId: Long) = null
}