I try to write code on Android to generate RSA key-pair and then generate Certificate Request file (.csr) like this image below: First I use spongycastle lib to generate Key Pair (public key and private key) Then I use CSRHelper class I found on this link to generate: byte CSRder[]: I write code to write byte[] to file: Final I