From 831e2497ed15b22e888c3e3795426d426401dee1 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Sat, 6 Jan 2024 01:29:34 +0100 Subject: [PATCH] Introduce ImplementationFactory.getPGPV4KeyPair() Preparation for v6 --- .../implementation/BcImplementationFactory.kt | 2 +- .../implementation/ImplementationFactory.kt | 11 ++++++++++- .../implementation/JceImplementationFactory.kt | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pgpainless-core/src/main/kotlin/org/pgpainless/implementation/BcImplementationFactory.kt b/pgpainless-core/src/main/kotlin/org/pgpainless/implementation/BcImplementationFactory.kt index dcf594ea..e889b978 100644 --- a/pgpainless-core/src/main/kotlin/org/pgpainless/implementation/BcImplementationFactory.kt +++ b/pgpainless-core/src/main/kotlin/org/pgpainless/implementation/BcImplementationFactory.kt @@ -86,7 +86,7 @@ class BcImplementationFactory : ImplementationFactory() { override fun getPGPDataEncryptorBuilder(symmetricKeyAlgorithm: Int): PGPDataEncryptorBuilder = BcPGPDataEncryptorBuilder(symmetricKeyAlgorithm) - override fun getPGPKeyPair( + override fun getPGPV4KeyPair( publicKeyAlgorithm: PublicKeyAlgorithm, keyPair: KeyPair, creationDate: Date diff --git a/pgpainless-core/src/main/kotlin/org/pgpainless/implementation/ImplementationFactory.kt b/pgpainless-core/src/main/kotlin/org/pgpainless/implementation/ImplementationFactory.kt index 58478379..ad2ac4c4 100644 --- a/pgpainless-core/src/main/kotlin/org/pgpainless/implementation/ImplementationFactory.kt +++ b/pgpainless-core/src/main/kotlin/org/pgpainless/implementation/ImplementationFactory.kt @@ -100,7 +100,16 @@ abstract class ImplementationFactory { abstract fun getPGPDataEncryptorBuilder(symmetricKeyAlgorithm: Int): PGPDataEncryptorBuilder @Throws(PGPException::class) - abstract fun getPGPKeyPair( + @Deprecated("Replace with versioned getter method, such as getPGPV4KeyPair()", + replaceWith = ReplaceWith("getPGPV4KeyPair")) + fun getPGPKeyPair( + publicKeyAlgorithm: PublicKeyAlgorithm, + keyPair: KeyPair, + creationDate: Date + ): PGPKeyPair = getPGPV4KeyPair(publicKeyAlgorithm, keyPair, creationDate) + + @Throws(PGPException::class) + abstract fun getPGPV4KeyPair( publicKeyAlgorithm: PublicKeyAlgorithm, keyPair: KeyPair, creationDate: Date diff --git a/pgpainless-core/src/main/kotlin/org/pgpainless/implementation/JceImplementationFactory.kt b/pgpainless-core/src/main/kotlin/org/pgpainless/implementation/JceImplementationFactory.kt index 865f1e0d..409b06fa 100644 --- a/pgpainless-core/src/main/kotlin/org/pgpainless/implementation/JceImplementationFactory.kt +++ b/pgpainless-core/src/main/kotlin/org/pgpainless/implementation/JceImplementationFactory.kt @@ -101,7 +101,7 @@ class JceImplementationFactory : ImplementationFactory() { override fun getPGPDataEncryptorBuilder(symmetricKeyAlgorithm: Int): PGPDataEncryptorBuilder = JcePGPDataEncryptorBuilder(symmetricKeyAlgorithm).setProvider(ProviderFactory.provider) - override fun getPGPKeyPair( + override fun getPGPV4KeyPair( publicKeyAlgorithm: PublicKeyAlgorithm, keyPair: KeyPair, creationDate: Date