All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tsec.mac.MessageAuth.scala Maven / Gradle / Ivy

The newest version!
package tsec.mac

import cats.Functor
import tsec.common.{CryptoTag, VerificationFailed, VerificationStatus, Verified}

trait MessageAuth[F[_], A, K[_]] {

  def algorithm: String

  def sign(in: Array[Byte], key: K[A]): F[MAC[A]]

  def verifyBool(in: Array[Byte], hashed: MAC[A], key: K[A]): F[Boolean]

  def verify(in: Array[Byte], hashed: MAC[A], key: K[A])(implicit F: Functor[F]): F[VerificationStatus] =
    F.map(verifyBool(in, hashed, key))(c => if (c) Verified else VerificationFailed)

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy