diff options
| author | Harsh Shandilya <me@msfjarvis.dev> | 2021-10-23 17:02:50 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-23 17:02:50 +0530 |
| commit | aac74ae4515aa1d746f46287029441f5a945c98e (patch) | |
| tree | 9d23e06592ecd884d6b58dd089692d9e4224a3f9 /crypto-pgp/src/androidTest/kotlin/dev/msfjarvis/aps/crypto/GPGKeyPairTest.kt | |
| parent | 21c8653e6815ca34574e783a5ce7ac783b188228 (diff) | |
| download | HardenedPass-aac74ae4515aa1d746f46287029441f5a945c98e.tar.gz HardenedPass-aac74ae4515aa1d746f46287029441f5a945c98e.zip | |
Switch new PGP backend to use PGPainless (#1522)
* crypto-pgpainless: init
* crypto-pgpainless: add an opinionated CryptoHandler impl
* app: migrate to crypto-pgpainless
* crypto-pgp: remove
* github: remove now unused instrumentation tests job
* crypto-common: fixup package names
* wip(crypto-pgpainless): add `PGPKeyPair` and `PGPKeyManager`
Signed-off-by: Aditya Wasan <adityawasan55@gmail.com>
(cherry picked from commit 02d07e9e797a8600cc8c534a731dfffcc44cfdde)
* crypto-pgpainless: use hex-encoded key IDs
* crypto-pgpainless: replace legacy Gopenpgp-generated key file
* crypto-pgpainless: fix CryptoConstants source set
* crypto-pgpainless: fix tests
* crypto-pgpainless: reinstate PGPKeyManager tests
Co-authored-by: Aditya Wasan <adityawasan55@gmail.com>
Diffstat (limited to 'crypto-pgp/src/androidTest/kotlin/dev/msfjarvis/aps/crypto/GPGKeyPairTest.kt')
| -rw-r--r-- | crypto-pgp/src/androidTest/kotlin/dev/msfjarvis/aps/crypto/GPGKeyPairTest.kt | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/crypto-pgp/src/androidTest/kotlin/dev/msfjarvis/aps/crypto/GPGKeyPairTest.kt b/crypto-pgp/src/androidTest/kotlin/dev/msfjarvis/aps/crypto/GPGKeyPairTest.kt deleted file mode 100644 index 2340d9a5..00000000 --- a/crypto-pgp/src/androidTest/kotlin/dev/msfjarvis/aps/crypto/GPGKeyPairTest.kt +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved. - * SPDX-License-Identifier: GPL-3.0-only - */ - -package dev.msfjarvis.aps.crypto - -import androidx.test.platform.app.InstrumentationRegistry -import com.proton.Gopenpgp.crypto.Key -import dev.msfjarvis.aps.crypto.utils.CryptoConstants -import dev.msfjarvis.aps.cryptopgp.test.R -import dev.msfjarvis.aps.data.crypto.GPGKeyPair -import dev.msfjarvis.aps.data.crypto.KeyPairException -import kotlin.test.assertEquals -import kotlin.test.assertFailsWith -import org.junit.Test - -public class GPGKeyPairTest { - - @Test - public fun testIfKeyIdIsCorrect() { - val gpgKey = Key(getKey()) - val keyPair = GPGKeyPair(gpgKey) - - assertEquals(CryptoConstants.KEY_ID, keyPair.getKeyId()) - } - - @Test - public fun testBuildingKeyPairWithoutPrivateKey() { - assertFailsWith<KeyPairException.PrivateKeyUnavailableException>( - "GPGKeyPair does not have a private sub key" - ) { - // Get public key object from private key - val gpgKey = Key(getKey()).toPublic() - // Try creating a KeyPair from public key - val keyPair = GPGKeyPair(gpgKey) - - keyPair.getPrivateKey() - } - } - - private companion object { - - fun getKey(): String = - InstrumentationRegistry.getInstrumentation() - .context - .resources - .openRawResource(R.raw.private_key) - .readBytes() - .decodeToString() - } -} |
