How to get base64 encoded SHA-256 hash cert

483 Views Asked by At

I need to get base64 encoded SHA-256 hash to do certificate pin

val certPinner = CertificatePinner.Builder()
    .add("hostName", "sha256/ASDfFgggg7YQB0Xt7Q5WZL5jhiRaXnPrjO/KwGh0G5g=")
    .build()

I usually get the String (after sha256/) through gitBash, but now I get a new cert and the public key is ECC (256 bits).

Is anybody know is there any other way that I can get base64 encoded SHA-256 hash cert? Thanks.

When I try to get the String though gitBash, it showed error like this

bash: $'\E[200~openssl': command not found
unable to load Public Key
86272:error:0909006C:PEM routines:get_name:no start line:../openssl-1.1.1q/crypto/pem/pem_lib.c:745:Expecting: PUBLIC KEY
enc: Unrecognized flag base64~
enc: Use -help for summary.

Also, I try this method Linked, but sometimes it can pinned success, but sometimes don't.

0

There are 0 best solutions below