<div><div><span style="color:rgb(49,49,49);word-spacing:1px">err I meant the OTPCertificate record. it seems to be defined during compilation. </span><br></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon 9 Mar 2020 at 17:53 Marc Worrell <<a href="mailto:marc@worrell.nl" target="_blank">marc@worrell.nl</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div>We create the certs using two methods:</div><div><br></div><div><span style="white-space:pre-wrap"> </span>- self signed certificates (snake oil)</div><div><span style="white-space:pre-wrap"> </span>- Let’s Encrypt certificates</div><div><br></div><div>And of course we also use certificates we buy from various sources.</div><div><br></div><div>I can add the self-signed cert creation to the library.</div></div><div style="word-wrap:break-word;line-break:after-white-space"><div><br></div><div>- Marc</div><div><br></div><div><br><blockquote type="cite"><div>On 9 Mar 2020, at 17:35, Benoit Chesneau <<a href="mailto:bchesneau@gmail.com" target="_blank">bchesneau@gmail.com</a>> wrote:</div><br><div><div dir="ltr">Thanks with that an the snippet from Leonard and Marc I have all what I need I thin;k. I will try later today to mix that. One thing I am not sure to understand is how this certificate is created and how you did find the information about it. Is there any place I should read for it?<div><br></div><div><br></div><div>Benoit</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 9, 2020 at 9:23 AM Roger Lipscombe <<a href="mailto:roger@differentpla.net" target="_blank">roger@differentpla.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">This is probably not complete (because we generate our own<br>
certificates), but here's what we use:<br>
<br>
-include_lib("public_key/include/public_key.hrl").<br>
<br>
get_certificate_subject_cn(#'OTPCertificate'{tbsCertificate = OTPTBS}) -><br>
get_certificate_subject_cn(OTPTBS);<br>
get_certificate_subject_cn(#'OTPTBSCertificate'{subject = Subject}) -><br>
get_cn(Subject).<br>
<br>
get_cn({rdnSequence, Seq}) -><br>
get_cn(Seq);<br>
get_cn([]) -><br>
undefined;<br>
get_cn([[#'AttributeTypeAndValue'{type = ?'id-at-commonName',<br>
value = {utf8String, Value}}] | _]) -><br>
Value;<br>
get_cn([_|Rest]) -><br>
get_cn(Rest).<br>
<br>
get_serial_number(#'OTPCertificate'{tbsCertificate = OTPTBS}) -><br>
get_serial_number(OTPTBS);<br>
get_serial_number(#'OTPTBSCertificate'{serialNumber = SerialNumber}) -><br>
SerialNumber.<br>
<br>
On Sun, 8 Mar 2020 at 23:34, Benoit Chesneau <<a href="mailto:bchesneau@gmail.com" target="_blank">bchesneau@gmail.com</a>> wrote:<br>
><br>
> How can I get informations about an SSL certificate ? Specifically I am looking for a way to retrieve the issuer, subject, and the serial number of the certificate.<br>
><br>
> The record I get from decoding using public_key functions is hard to parse so any help is welcome. Maybe there is already an api/app somewhere for it?<br>
><br>
> Benoît<br>
><br>
><br>
</blockquote></div>
</div></blockquote></div><br></div></blockquote></div></div>-- <br><div dir="ltr" data-smartmail="gmail_signature">Sent from my Mobile</div>
</div>