com.dwolla.security.crypto.exceptions.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fs2-pgp-bcpg1.72.1_2.13 Show documentation
Show all versions of fs2-pgp-bcpg1.72.1_2.13 Show documentation
fs2 pipes for encrypting and decrypting streams with BouncyCastle PGP 1.72.1
The newest version!
package com.dwolla.security.crypto
import scala.util.control.NoStackTrace
class KeyRingMissingKeyException private (expectedKeyId: Option[Long])
extends RuntimeException(s"Cannot decrypt message with the passed keyring because ${expectedKeyId.fold("it does not contain a compatible key and the message recipient is hidden")(id => s"it requires key $id, but the ring does not contain that key")}")
with NoStackTrace
object KeyRingMissingKeyException {
def apply(expectedKeyId: Option[Long]) = new KeyRingMissingKeyException(expectedKeyId)
}
class KeyMismatchException private (expectedKeyId: Option[Long], val actualKeyId: Long)
extends RuntimeException(s"Cannot decrypt message with key $actualKeyId${expectedKeyId.fold(". (The message recipient is hidden.)")(id => s" because it requires key $id")}")
with NoStackTrace
object KeyMismatchException {
def apply(expectedKeyId: Option[Long], actualKeyId: Long) =
new KeyMismatchException(expectedKeyId, actualKeyId)
}
object EncryptionTypeError
extends RuntimeException("encrypted data was not PGPPublicKeyEncryptedData")
with NoStackTrace