From 8f7e4a405e0b6f2fd969c1fe3027b8f6b066c156 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Fri, 12 Aug 2022 00:04:25 +0530 Subject: Upgrade all dependencies (#2057) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .../src/main/kotlin/app/passwordstore/crypto/KeyUtils.kt | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'crypto-pgpainless/src') diff --git a/crypto-pgpainless/src/main/kotlin/app/passwordstore/crypto/KeyUtils.kt b/crypto-pgpainless/src/main/kotlin/app/passwordstore/crypto/KeyUtils.kt index 586603fd..47c06c4f 100644 --- a/crypto-pgpainless/src/main/kotlin/app/passwordstore/crypto/KeyUtils.kt +++ b/crypto-pgpainless/src/main/kotlin/app/passwordstore/crypto/KeyUtils.kt @@ -10,7 +10,7 @@ import app.passwordstore.crypto.GpgIdentifier.UserId import com.github.michaelbull.result.get import com.github.michaelbull.result.runCatching import org.bouncycastle.openpgp.PGPKeyRing -import org.pgpainless.PGPainless +import org.pgpainless.key.parsing.KeyRingReader /** Utility methods to deal with [PGPKey]s. */ public object KeyUtils { @@ -19,15 +19,7 @@ public object KeyUtils { * then as a public one before the method gives up and returns null. */ public fun tryParseKeyring(key: PGPKey): PGPKeyRing? { - val secKeyRing = runCatching { PGPainless.readKeyRing().secretKeyRing(key.contents) }.get() - if (secKeyRing != null) { - return secKeyRing - } - val pubKeyRing = runCatching { PGPainless.readKeyRing().publicKeyRing(key.contents) }.get() - if (pubKeyRing != null) { - return pubKeyRing - } - return null + return runCatching { KeyRingReader.readKeyRing(key.contents.inputStream()) }.get() } /** Parses a [PGPKeyRing] from the given [key] and calculates its long key ID */ -- cgit v1.2.3