Skip to content

Instantly share code, notes, and snippets.

@seratch
Created July 10, 2012 13:06
Show Gist options
  • Save seratch/3083123 to your computer and use it in GitHub Desktop.
Save seratch/3083123 to your computer and use it in GitHub Desktop.
KeyczarService.scala
import java.net.URLDecoder
import java.io.File
import org.keyczar.Crypter
case class KeyczarService(keypath: String) {
lazy val keyLocation = URLDecoder.decode(
new File(classOf[KeyczarService].getClassLoader.getResource(keypath).getFile).getAbsolutePath,
"UTF-8"
)
lazy val crypter = new Crypter(keyLocation)
def encrypt(clearText: String) = crypter.encrypt(clearText)
def decrypt(encrypted: String) = crypter.decrypt(encrypted)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment