1月 262013
 

使用openssl生成密钥对:

 

java代码:

1. 注意: java 语言本身没有实现base64编码,而openssl生成的密钥对一般做base64编码,便于维护,所以这里引用了 org.apache.commons.codec.binary.Base64;

 

稍后提供一个PHP加密Java解密的实现

 

参考资料:

http://stackoverflow.com/questions/11787571/how-to-read-pem-file-to-get-private-and-public-key

http://stackoverflow.com/questions/8647165/how-to-sign-a-generic-text-with-rsa-key-and-encode-with-base64-in-java

http://www.javamex.com/tutorials/cryptography/rsa_encryption.shtml

http://snowolf.iteye.com/blog/381767

密钥结构及格式: https://polarssl.org/kb/cryptography/asn1-key-structures-in-der-and-pem

 

 

 

 Posted by at 下午 8:22

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

(required)

(required)

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据