Created
July 10, 2012 13:06
-
-
Save seratch/3083123 to your computer and use it in GitHub Desktop.
KeyczarService.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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