Skip to content

CF-04020 비밀번호 복호화에 문제가 발생했습니다. 요청 파라미터 중 비밀번호 항목을 확인하세요. #3

Description

@KyeonghunSeo

계정등록 요청시
CF-04020 오류가 발생합니다.
아래는 kotlin 암호화 코드 입니다.

`object RSAUtil {
private val keyFactory = KeyFactory.getInstance("RSA")

fun encrypt(data: String, base64PublicKey: String): String {
    val cipher = Cipher.getInstance("RSA")
    cipher.init(Cipher.ENCRYPT_MODE, getPublicKey(base64PublicKey))
    val encrypted = cipher.doFinal(data.toByteArray())
    return Base64.getEncoder().encodeToString(encrypted)
}

private fun getPublicKey(base64PublicKey: String): PublicKey {
    val keySpec = X509EncodedKeySpec(Base64.getDecoder().decode(base64PublicKey.toByteArray()))
    return keyFactory.generatePublic(keySpec)
}

}`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions