-
-
Save MarcoSignoretto/0f2fe5d9250f426fe0e2603351afe6c4 to your computer and use it in GitHub Desktop.
This file contains 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
class StringCipherImpl constructor( | |
private val cipher: SymmetricCipher | |
) : StringCipher { | |
override fun encrypt(securityKey: SecurityKey, plainData: String): BinaryData = | |
cipher.encrypt(securityKey, plainData.encodeToByteArray().toBinaryData()) | |
override fun decrypt(securityKey: SecurityKey, encryptedData: BinaryData): String = | |
cipher.decrypt(securityKey, encryptedData.toByteArray().toBinaryData()).toByteArray() | |
.decodeToString() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment