File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
core/datastore/src/main/kotlin/com/ninecraft/booket/core/datastore/security Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -56,8 +56,8 @@ class CryptoManager @Inject constructor() {
5656
5757 fun decrypt (encodedText : String ): String {
5858 val combined = Base64 .decode(encodedText, Base64 .NO_WRAP )
59- val iv = combined.copyOfRange(0 , cipher.blockSize )
60- val encrypted = combined.copyOfRange(cipher.blockSize , combined.size)
59+ val iv = combined.copyOfRange(0 , IV_SIZE )
60+ val encrypted = combined.copyOfRange(IV_SIZE , combined.size)
6161 cipher.init (Cipher .DECRYPT_MODE , getKey(), IvParameterSpec (iv))
6262 val decryptedString = String (cipher.doFinal(encrypted))
6363 return decryptedString
@@ -69,5 +69,6 @@ class CryptoManager @Inject constructor() {
6969 private const val BLOCK_MODE = KeyProperties .BLOCK_MODE_CBC
7070 private const val PADDING = KeyProperties .ENCRYPTION_PADDING_PKCS7
7171 private const val TRANSFORMATION = " $ALGORITHM /$BLOCK_MODE /$PADDING "
72+ private const val IV_SIZE = 16 // AES IV는 항상 16바이트
7273 }
7374}
You can’t perform that action at this time.
0 commit comments