Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
KyeonghunSeo opened this issue Apr 1, 2020 · 0 comments

Comments

@KyeonghunSeo
Copy link

KyeonghunSeo commented Apr 1, 2020

계정등록 요청시
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)
}

}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant