java.security.spec.InvalidKeySpecException: java.lang.RuntimeException: error:0c0000be:ASN.1 encoding routines:OPENSSL_internal:WRONG_TAG

Viewed 57

I am implementing revenue monster sdk in my android kotlin project. This is the sdk github repo link->

https://github.com/RevenueMonster/rm-kotlin-sdk

This is my code in main activity.

 val rsaKeyStr = "-----BEGIN RSA PRIVATE KEY-----"PRIVATEKEY"-----END RSA PRIVATE KEY-----"
    val config = Config(
    clientID = "CLIENTID",
    clientSecret = "JjMHZCCyzvNlSaRQqwfPlXXDbGoWmAAA",
    privateKey = rsaKeyStr,
    publicKey = "-----BEGIN PUBLIC KEY-----" +
    "PUBLICKEY"
    "-----END PUBLIC KEY-----",
    sandbox = true
    )
    GlobalScope.launch {
    try {
    val sdk = RevenueMonsterSDK(config)
    val data = WebMobilePaymentRequest(
    order = Order(
    id = "1655811603734186872",
    title = "PaymentTest",
    detail = "JUST A TEST",
    additionalData = "NONE",
    amount = 11,
    currencyType = "MYR"
    ),
    storeId = "1623743430847879711",
    customer = WebMobilePaymentCustomer(
    userId = "12345",
    email = ""
    ),
    type = "MOBILE_PAYMENT",
    layoutVersion = "v3",
    notifyUrl = "https://dev-rm-api.ap.ngrok.io",
    redirectUrl = "https://revenuemonster.my"
    )
    // create quick pay order
    val result = sdk.Payment.webMobilePayment(data)
    Log.e("result::>", result.toString())
    } catch (e: Error) {
    Log.e("ERROR::>", e.toString())
    } catch (e: Throwable) {
    Log.e("Throwable::>", e.toString())
    }

Currenlty i am getting this error ->

java.security.spec.InvalidKeySpecException: java.lang.RuntimeException: error:0c0000be:ASN.1 encoding routines:OPENSSL_internal:WRONG_TAG


Added public key and private key in string format. other operations are being performed by sdk itself.

If anyone has implemented the revenuemonster sdk kindly give idea about the issue.

0 Answers
Related