<div dir="ltr">







<p class=""><span class="">Hi, Ingela,</span></p>
<p class=""><span class=""></span><br></p>
<p class=""><span class="">     According to google, the key is "</span><span class="">Base64-encoded RSA public key</span><span class="">”.</span></p>
<p class=""><span class="">    After add header/footer, I’m able to generate public key record now.</span></p>
<p class=""><span class=""></span><br></p>
<p class=""><span class="">    Thank you for your kindly help.</span></p>
<p class=""><span class=""></span><br></p>
<p class=""><span class="">     Best regards,</span></p>
<p class=""><span class="">     Xiaobin Xu</span></p></div><div class="gmail_extra"><br><div class="gmail_quote">2014-10-29 21:20 GMT+08:00 Ingela Andin <span dir="ltr"><<a href="mailto:ingela.andin@gmail.com" target="_blank">ingela.andin@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi!<br><div><div class="gmail_extra"><br><div class="gmail_quote"><span class="">2014-10-29 6:05 GMT+01:00 Xiaobin Xu <span dir="ltr"><<a href="mailto:xuxb1979@gmail.com" target="_blank">xuxb1979@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">hi, <div><br></div><div>    I tried to implement google play store signature verification in erlang this morning, I think i can use public_key:verify(Msg, DigestType, Signature, Key) -> boolean() to do my job, but I don't know how to generate a public key from encoded public key provided by play store.</div><div><br></div></div></blockquote><div><br></div></span><div>It depends on what encoding you have?  There is public_key:pem_decode that handles PEM-encoding. (Basically Base64 encoded ASN-1 DER blobs rapped in some<br></div><div>header/footer lines)<br><br></div><div>When you have a ASN-1 DER blob you can use public_key:der_decode(ASN1-type, DER)  to get the erlang record for that ASN-1 type.<br></div><div><br><br></div><div>Regards Ingela Erlang/OTP team - Ericsson AB <br></div><div><br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><div dir="ltr"><div></div><div>     In case of java, we can do this:</div><div><br></div><div>            <span>byte</span><span>[] </span>decodedKey<span> = Base64.decode(</span>encodedPublicKey<span>, Base64.</span>DEFAULT<span>);</span></div>








<p>            KeyFactory <span>keyFactory</span> = KeyFactory.getInstance(<span>KEY_FACTORY_ALGORITHM</span>);</p>
<p>            <span>return</span> <span>keyFactory</span>.generatePublic(<span>new</span> X509EncodedKeySpec(<span>decodedKey</span>));</p><p>    </p><p>     Thanks,</p><p>      Xiaobin, Xu    </p><p>     </p></div>
<br></span>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div></div></div>
</blockquote></div><br></div>