remove deprecated util.Crypt, #21423

This commit is contained in:
Patrik Nordwall 2017-01-19 14:53:51 +01:00
parent e69fc6e934
commit cc8c543b90
2 changed files with 4 additions and 41 deletions

View file

@ -1,41 +0,0 @@
/**
* Copyright (C) 2009-2017 Lightbend Inc. <http://www.lightbend.com>
*/
package akka.util
import java.security.{ MessageDigest, SecureRandom }
@deprecated(message = "Not in use.", since = "2.4-M1")
object Crypt {
val hex = "0123456789ABCDEF"
val lineSeparator = System.getProperty("line.separator")
lazy val random = SecureRandom.getInstance("SHA1PRNG")
def md5(text: String): String = md5(unifyLineSeparator(text).getBytes("ASCII"))
def md5(bytes: Array[Byte]): String = digest(bytes, MessageDigest.getInstance("MD5"))
def sha1(text: String): String = sha1(unifyLineSeparator(text).getBytes("ASCII"))
def sha1(bytes: Array[Byte]): String = digest(bytes, MessageDigest.getInstance("SHA1"))
def generateSecureCookie: String = {
val bytes = Array.fill(32)(0.byteValue)
random.nextBytes(bytes)
sha1(bytes)
}
def digest(bytes: Array[Byte], md: MessageDigest): String = {
md.update(bytes)
hexify(md.digest)
}
def hexify(bytes: Array[Byte]): String = {
val builder = new java.lang.StringBuilder(bytes.length * 2)
bytes.foreach { byte builder.append(hex.charAt((byte & 0xF0) >> 4)).append(hex.charAt(byte & 0xF)) }
builder.toString
}
private def unifyLineSeparator(text: String): String = text.replaceAll(lineSeparator, "\n")
}

View file

@ -257,6 +257,10 @@ object MiMa extends AutoPlugin {
ProblemFilters.exclude[IncompatibleMethTypeProblem]("akka.event.EventStream.this"),
ProblemFilters.exclude[MissingClassProblem]("akka.event.japi.ActorEventBus"),
// #21423 remove deprecated util.Crypt
ProblemFilters.exclude[MissingClassProblem]("akka.util.Crypt"),
ProblemFilters.exclude[MissingClassProblem]("akka.util.Crypt$"),
// #21423 removal of deprecated `PersistentView` (in 2.5.x)
ProblemFilters.exclude[MissingClassProblem]("akka.persistence.Update"),
ProblemFilters.exclude[MissingClassProblem]("akka.persistence.Update$"),