Skip to content

Commit

Permalink
Use Bouncycastle's Base64 implementation, for Android support
Browse files Browse the repository at this point in the history
Fixes #21
  • Loading branch information
nodh committed Jun 22, 2021
1 parent 09d569d commit e3ead27
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package ehn.techiop.hcert.kotlin.chain

import java.util.*
import org.bouncycastle.util.encoders.Base64

actual fun ByteArray.asBase64() = Base64.getEncoder().encodeToString(this)
actual fun ByteArray.asBase64() = Base64.toBase64String(this)

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

actual fun String.fromBase64() = Base64.getDecoder().decode(this)
actual fun String.fromBase64() = Base64.decode(this)

actual fun String.fromHexString() = chunked(2).map { it.toInt(16).toByte() }.toByteArray()

Expand Down

0 comments on commit e3ead27

Please sign in to comment.