blob: 33597f9fa1588c6dd4e149e2ce2e5124165d10c1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
package dev.msfjarvis.aps.crypto
import dev.msfjarvis.aps.crypto.KeyUtils.tryGetId
import dev.msfjarvis.aps.crypto.KeyUtils.tryParseKeyring
import dev.msfjarvis.aps.crypto.TestUtils.getArmoredPrivateKeyWithMultipleIdentities
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertIs
import kotlin.test.assertNotNull
import org.bouncycastle.openpgp.PGPSecretKeyRing
class KeyUtilsTest {
@Test
fun parseKeyWithMultipleIdentities() {
val key = PGPKey(getArmoredPrivateKeyWithMultipleIdentities())
val keyring = tryParseKeyring(key)
assertNotNull(keyring)
assertIs<PGPSecretKeyRing>(keyring)
val keyId = tryGetId(key)
assertNotNull(keyId)
assertIs<GpgIdentifier.KeyId>(keyId)
assertEquals("b950ae2813841585", keyId.toString())
}
}
|