Help Call Private api

I need help

When requesting the above url, I get the message “{“code”:-1022,“msg”:“Signature for this request is not valid.”}”

Through the Binance example I confirmed that my hmac hashing algorithm works
(When you put the sample private key and query, the same encryption key as the example appears)

Please help me I can’t fix the cause

My kotlin code generate hmac

fun getHmac(message: String,key:String): String? {
try {
val hasher = Mac.getInstance(“HmacSHA256”)
hasher.init(SecretKeySpec(key.toByteArray(), “HmacSHA256”))

    val hash = hasher.doFinal(message.toByteArray())
    return byteToString(hash)
} catch (e: NoSuchAlgorithmException) {
} catch (e: InvalidKeyException) {
return ""


One simple way to verify if your encryption method is working:

let’s pretend your API secret is ‘aaa’, what would you get as signature for “timestamp=1609384651688”?