0

I have CSR bytes. I would like to parse it to retrieve all domains from it (including alternative names). How to do it?

I imagine it should be something like:

byte[] csrBytes = readMyCSR();
List<String> domains = retrieveDomains(csrBytes);
Oleksandr
  • 3,574
  • 8
  • 41
  • 78
  • Domains should be as Common Name, so retrieve CN field. – Antoniossss Jun 17 '18 at 10:48
  • @Antoniossss how to retrieve common name and alternative names? I tried with bounycycastle (JcaPKCS10CertificationRequest) but I didn't find the right way to do it. – Oleksandr Jun 17 '18 at 11:01
  • Why not google it? https://stackoverflow.com/questions/2914521/how-to-extract-cn-from-x509certificate-in-java OR https://stackoverflow.com/questions/21912390/decode-read-a-csr-certificate-signing-request-using-java-or-bouncycastle – Antoniossss Jun 17 '18 at 11:14
  • But `X509Certificate` isn't a CSR. It is an already generated certificate. Another answer doesn't highlight alternative names retrieval. – Oleksandr Jun 17 '18 at 11:26
  • If it shows you how te get 1 part of certificate, you should know where to look for any other part of certificate. – Antoniossss Jun 17 '18 at 11:31
  • https://stackoverflow.com/a/45424266/1527544 – Antoniossss Jun 17 '18 at 11:50
  • @Antoniossss Thank you very much! It is what I need. Seems that I was searching bad. – Oleksandr Jun 17 '18 at 18:09

0 Answers0