trait SecurityHelpers extends AnyRef
The SecurityHelpers trait provides functions to:
- generate random numbers
- generate keys
- encrypt/decrypt keys
- create SHA, SHA-256, MD5 hashes (can be hex encoded)
- Self Type
- SecurityHelpers with StringHelpers with IoHelpers
- Alphabetic
- By Inheritance
- SecurityHelpers
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
base64Decode(in: String): Array[Byte]
decode a String in Base 64
-
def
base64Encode(in: Array[Byte]): String
encode a Byte array in Base 64
-
def
base64EncodeURLSafe(in: Array[Byte]): String
encode a Byte array in Base 64 in a way that's safe for use in URLs
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hash(in: String): String
create a SHA hash from a String
-
def
hash(in: Array[Byte]): Array[Byte]
create a SHA hash from a Byte array
-
def
hash256(in: String): String
create a SHA-256 hash from a String
-
def
hash256(in: Array[Byte]): Array[Byte]
create a SHA-256 hash from a Byte array
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
def
hashHex(in: String): String
create a SHA hash from a String
- def hexDecode(str: String): Array[Byte]
-
def
hexDigest(in: Array[Byte]): String
create a hex encoded SHA hash from a Byte array
-
def
hexDigest256(in: Array[Byte]): String
create a hex encoded SHA-256 hash from a Byte array
-
def
hexEncode(in: Array[Byte]): String
encode a Byte array as hexadecimal characters
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
md5(in: String): String
create a MD5 digest from a String
-
def
md5(in: Array[Byte]): Array[Byte]
create a MD5 digest from a Byte array
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
randomInt(mod: Int): Int
return a random int modulo a number
-
def
randomLong(mod: Long): Long
return a random Long modulo a number
-
def
secureEquals(s1: Array[Byte], s2: Array[Byte]): Boolean
Compare two byte arrays in a way that does not vary if the arrays are determined to be not equal early (test every byte...
Compare two byte arrays in a way that does not vary if the arrays are determined to be not equal early (test every byte... avoids timing attacks
-
def
secureEquals(s1: String, s2: String): Boolean
Compare two strings in a way that does not vary if the strings are determined to be not equal early (test every byte...
Compare two strings in a way that does not vary if the strings are determined to be not equal early (test every byte... avoids timing attacks
-
def
secureXML: XMLLoader[Elem]
Provides a secure XML parser, similar to the one provided by
scala.xml.XML
, but with external entities and doctypes disabled and secure XML processing enabled.Provides a secure XML parser, similar to the one provided by
scala.xml.XML
, but with external entities and doctypes disabled and secure XML processing enabled. This prevents XXE (XML External Entities) attacks, billion laughs attacks, quadratic blowup attacks, and others. It is used internally throughout Lift, and should be used by anyone who is parsing XML from an untrusted source. -
def
shouldShow(percent: Double): Boolean
return true only 'percent' times when asked repeatedly.
return true only 'percent' times when asked repeatedly. This function is used in the Skittr example to get a random set of users
- percent
percentage as a double number <= 1.0
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )