aboutsummaryrefslogtreecommitdiffstats
path: root/crypto-common/src/main/kotlin/dev/msfjarvis/aps/crypto/CryptoException.kt
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2021-10-23 17:02:50 +0530
committerGitHub <noreply@github.com>2021-10-23 17:02:50 +0530
commitaac74ae4515aa1d746f46287029441f5a945c98e (patch)
tree9d23e06592ecd884d6b58dd089692d9e4224a3f9 /crypto-common/src/main/kotlin/dev/msfjarvis/aps/crypto/CryptoException.kt
parent21c8653e6815ca34574e783a5ce7ac783b188228 (diff)
downloadHardenedPass-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-common/src/main/kotlin/dev/msfjarvis/aps/crypto/CryptoException.kt')
-rw-r--r--crypto-common/src/main/kotlin/dev/msfjarvis/aps/crypto/CryptoException.kt19
1 files changed, 19 insertions, 0 deletions
diff --git a/crypto-common/src/main/kotlin/dev/msfjarvis/aps/crypto/CryptoException.kt b/crypto-common/src/main/kotlin/dev/msfjarvis/aps/crypto/CryptoException.kt
new file mode 100644
index 00000000..34e64d5f
--- /dev/null
+++ b/crypto-common/src/main/kotlin/dev/msfjarvis/aps/crypto/CryptoException.kt
@@ -0,0 +1,19 @@
+package dev.msfjarvis.aps.crypto
+
+public sealed class CryptoException(message: String? = null) : Exception(message)
+
+public sealed class KeyPairException(message: String? = null) : CryptoException(message) {
+ public object PrivateKeyUnavailableException :
+ KeyPairException("Key object does not have a private sub-key")
+}
+
+public sealed class KeyManagerException(message: String? = null) : CryptoException(message) {
+ public object NoKeysAvailableException : KeyManagerException("No keys were found")
+ public object KeyDirectoryUnavailableException :
+ KeyManagerException("Key directory does not exist")
+ public object KeyDeletionFailedException : KeyManagerException("Couldn't delete the key file")
+ public class KeyNotFoundException(keyId: String) :
+ KeyManagerException("No key found with id: $keyId")
+ public class KeyAlreadyExistsException(keyId: String) :
+ KeyManagerException("Pre-existing key was found for $keyId but 'replace' is set to false")
+}