aboutsummaryrefslogtreecommitdiff
path: root/crypto-pgpainless
diff options
context:
space:
mode:
authorTad Fisher <tadfisher@gmail.com>2022-10-09 15:10:10 -0700
committerTad Fisher <tadfisher@gmail.com>2022-10-09 16:13:36 -0700
commit4b7457c7f712b92f21604d8612ec8ff19df75c81 (patch)
treebf1256e72d1ead8079daa514c5f9c0a96469ab73 /crypto-pgpainless
parenta244a0f3b84d64cceaf0eefd662c78aadab2514e (diff)
Add crypto-hwsecurity library
Diffstat (limited to 'crypto-pgpainless')
-rw-r--r--crypto-pgpainless/build.gradle.kts2
-rw-r--r--crypto-pgpainless/src/main/kotlin/app/passwordstore/crypto/PGPSessionKey.kt16
2 files changed, 17 insertions, 1 deletions
diff --git a/crypto-pgpainless/build.gradle.kts b/crypto-pgpainless/build.gradle.kts
index 93d56eff..bff2bcf2 100644
--- a/crypto-pgpainless/build.gradle.kts
+++ b/crypto-pgpainless/build.gradle.kts
@@ -15,7 +15,7 @@ dependencies {
implementation(libs.dagger.hilt.core)
implementation(libs.kotlin.coroutines.core)
implementation(libs.thirdparty.kotlinResult)
- implementation(libs.thirdparty.pgpainless)
+ api(libs.thirdparty.pgpainless)
testImplementation(libs.bundles.testDependencies)
testImplementation(libs.kotlin.coroutines.test)
testImplementation(libs.testing.testparameterinjector)
diff --git a/crypto-pgpainless/src/main/kotlin/app/passwordstore/crypto/PGPSessionKey.kt b/crypto-pgpainless/src/main/kotlin/app/passwordstore/crypto/PGPSessionKey.kt
new file mode 100644
index 00000000..42055cb4
--- /dev/null
+++ b/crypto-pgpainless/src/main/kotlin/app/passwordstore/crypto/PGPSessionKey.kt
@@ -0,0 +1,16 @@
+package app.passwordstore.crypto
+
+import org.bouncycastle.openpgp.PGPPublicKey
+import org.bouncycastle.openpgp.PGPSessionKey
+import org.pgpainless.algorithm.PublicKeyAlgorithm
+
+public class PGPEncryptedSessionKey(
+ public val publicKey: PGPPublicKey,
+ public val algorithm: PublicKeyAlgorithm,
+ public val contents: ByteArray
+)
+
+public fun PGPSessionKey(
+ algorithm: PublicKeyAlgorithm,
+ sessionKey: ByteArray
+): PGPSessionKey = PGPSessionKey(algorithm.algorithmId, sessionKey)