aboutsummaryrefslogtreecommitdiffstats
path: root/crypto-common/src/main/kotlin/dev/msfjarvis/aps/crypto/CryptoException.kt
blob: 34e64d5f5f92a9c3a3c90ffc836be56e5fdc6d76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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")
}