Skip to content

Commit

Permalink
Fixed Base64 encoding extenstions (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksandrsarapulovgl authored May 13, 2021
1 parent cb0cb9b commit 26e7515
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions decoder/src/main/java/dgca/verifier/app/decoder/Extensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ import java.util.Base64
const val ECDSA_256 = -7
const val RSA_PSS_256 = -37

fun ByteArray.asBase64(): String = Base64.getEncoder().encodeToString(this)

fun ByteArray.toBase64(): String = Base64.getUrlEncoder().encodeToString(this)
fun ByteArray.toBase64(): String = Base64.getEncoder().encodeToString(this)

fun ByteArray.toHexString(): String = joinToString("") { "%02x".format(it) }

Expand All @@ -56,7 +54,7 @@ fun String.base64ToX509Certificate(): X509Certificate? {
fun ByteArray.toHash(): String {
return MessageDigest.getInstance("SHA-256")
.digest(this)
.asBase64()
.toBase64()
}

fun ByteArray.generateKeyPair(): KeyPairData? {
Expand Down

0 comments on commit 26e7515

Please sign in to comment.