jks

ActiveMQ持久化到MySQL以及使用SSL协议通讯

烂漫一生 提交于 2019-12-01 02:20:02
最近公司事情稍微少了点,研究下怎么优化几个系统的交互,因为我们目前使用的是长链接的同步接口,就考虑用下MQ来处理下。 由于公司对安全有要求且和CA业务有关,则使用了SSL协议。此文使用的是Activemq的SSL协议+MYSQL作为持久化数据库,后续可能使用NIO+SSL协议。 其他实现了JMS的MQ应该也大同小异。 此文大多是参考官网文档 持久化: http://activemq.apache.org/persistence.html 相关协议: http://activemq.apache.org/configuring-transports.html 先说说我对activemq的理解,由于是用java语言开发的,给我的感觉是依赖spring并且跑在jetty上的一个java程序。有了个大概的概念里面配置的东西就更好理解。 配置mysql持久化,默认持久化是使用的kahadb写入文件里,这里修改成jdbc方式连接mysql,既然是jdbc就需要一个数据库驱动的jar包, 所以我们需要在lib文件夹下放入mysql-connector-java-5.1.34-bin.jar(其他版本一样),因为使用的是官网推荐的dbcp数据源,相关其他的依赖包在lib下面已经有了。 想要使用其他的数据源则需要引入相关依赖的jar包即可。 以下是activemq.xml的mysql持久化配置。

Specification of JKS key store format

假如想象 提交于 2019-11-30 20:18:11
I was wondering if there exists an official specification of the JKS key store format used in Java? I'd like to write a converter from/to PKCS#12, but not in Java, so keytool or Java code is not an option unfortunately. Looking at one in a hex editor tells me that it's probably not ASN.1. Before I start digging into OpenJDK, trying to reverse-engineer the format, does anyone know if there exists a spec maybe? I couldn't find anything so far, any help would be much appreciated! I think you should start your research at JDK sources . There are some very useful comments there. E.g. /* * KEYSTORE

PFX to JKS keytool conversion: Alias <*> does not exist

懵懂的女人 提交于 2019-11-30 19:16:21
I'm trying to convert x.PFX file to x.JKS file using keytool but I am getting following error: keytool error: java.lang.Exception: Alias <2> does not exist Actions that preceded this error are: Listing x.PFX file content (just to read alias name): keytool -v -list -storetype pkcs12 -keystore x.pfx Enter keystore password: x Keystore type: PKCS12 Keystore provider: SunJSSE Your keystore contains 1 entry Alias name: 2 Creation date: 11-nov-2012 Entry type: PrivateKeyEntry Certificate chain length: 3 Certificate[1]: Owner: CN=x, OU=x, C=x Issuer: CN=x, O=x, C=x Serial number: x Valid from: Wed

用SSL构建安全的Socket

狂风中的少年 提交于 2019-11-30 11:01:08
SSL( 安全 套接层)是 Netscape公司在1994年开发的,最初用于WEB浏览器,为浏览器与 服务器 间的数据传递提供 安全 保障,提供了加密、来源认证和数据完整性的功能。现在SSL3.0得到了普遍的使用,它的改进版TLS(传输层安全)已经成为 互联网 标准。SSL本身和TCP套接字连接是很相似的,在 协议 栈中,SSL可以被简单的看作是安全的TCP连接,但是某些TCP连接的特性它是不支持的,比如带外数据(out-of-bound)。 在构建基于 Socket的C/S程序时,通过添加对SSL的支持来保障数据安全和完整是不错的方法。完善的 Java 为我们提供了简单的实现方法:JSSE( Java 安全套接字扩展)。JSSE是一个纯Java实现的SSL和TLS 协议 框架,抽象了SSL和TLS复杂的算法,使安全问题变得简单。JSSE已经成为 J2SE1.4版本中的标准组件,支持SSL 3.0和TLS 1.0。我们将通过一个具体的例子演示JSSE的一些基本应用。例子中的 服务器 端将打开一个SSL Socket,只有持有指定证书的客户端可以与它连接,所有的数据传递都是加密的。 构造一个SSLSocket是非常简单的: SSLServerSocketFactory factory=(SSLServerSocketFactory)SSLServerSocketFactory

What causes keytool error “Failed to decrypt safe contents entry”?

寵の児 提交于 2019-11-30 06:02:05
I am trying to convert a standard PKCS #12 (.p12) key store into a Java JKS key store with this command: keytool -importkeystore -srckeystore keystore.p12 -srcstoretype PKCS12 -deststoretype JKS -destkeystore keystore.jks It is failing with: keytool error: java.io.IOException: failed to decrypt safe contents entry: javax.crypto.BadPaddingException: Given final block not properly padded Do you have any idea how to solve this problem? Sometimes this error is symptomatic of using an incorrect password for the p12 key. The pkcs12 keystore was corrupt indeed. axiopisty I've never attempted to do

java keytool支持的类型及如何将证书导入jks中

无人久伴 提交于 2019-11-30 01:53:51
简介 Java自带的keytool工具是个密钥和证书管理工具。它使用户能够管理自己的公钥/私钥对及相关证书,用于(通过数字签名)自我认证(用户向别的用户/服务认证自己)或数据完整性以及认证服务。它还允许用户储存他们的通信对等者的公钥(以证书形式)。 keytool 将密钥和证书储存在一个所谓的密钥仓库(keystore)中。缺省的密钥仓库实现将密钥仓库实现为一个文件。它用口令来保护私钥。 Java KeyStore的类型 JKS和JCEKS是Java密钥库(KeyStore)的两种比较常见类型(我所知道的共有5种,JKS, JCEKS, PKCS12, BKS,UBER)。 JKS的Provider是SUN,在每个版本的JDK中都有,JCEKS的Provider是SUNJCE,1.4后我们都能够直接使用它。 JCEKS在安全级别上要比JKS强,使用的Provider是JCEKS(推荐),尤其在保护KeyStore中的私钥上(使用TripleDes)。 PKCS#12是公钥加密标准,它规定了可包含所有私钥、公钥和证书。其以二进制格式存储,也称为 PFX 文件,在windows中可以直接导入到密钥区,注意,PKCS#12的密钥库保护密码同时也用于保护Key。 BKS 来自BouncyCastle Provider,它使用的也是TripleDES来保护密钥库中的Key

Specification of JKS key store format

二次信任 提交于 2019-11-29 18:37:25
问题 I was wondering if there exists an official specification of the JKS key store format used in Java? I'd like to write a converter from/to PKCS#12, but not in Java, so keytool or Java code is not an option unfortunately. Looking at one in a hex editor tells me that it's probably not ASN.1. Before I start digging into OpenJDK, trying to reverse-engineer the format, does anyone know if there exists a spec maybe? I couldn't find anything so far, any help would be much appreciated! 回答1: I think

Oracle Database TLS1.2 / SSL connection using JDBC thin and JKS

无人久伴 提交于 2019-11-29 09:36:37
问题 When tried to connect to Oracle Database 12c using 12.1.0.2 JDBC Thin driver, we are getting an exception. We are using TLSv1.2 with JKS certificates. But, we are unable to connect to the database successfully. Exception in thread "main" java.sql.SQLRecoverableException: IO Error: Received fatal alert: handshake_failure 回答1: Here are the steps to follow to configure the Oracle JDBC thin driver to connect to the Database using TLS v1.2 (assuming your Database configuration is correct). Step 1:

How to use PEM file to create a SSL socket in Java?

孤街醉人 提交于 2019-11-29 09:34:47
See related question. I have a PEM file provided to me and was told that it will be needed in establishing a SSL socket that connects to a c++ server for some API calls. Does anyone know how I can read in the PEM file and connect? I was also given the parapharse password. It sounds like the PEM file is a client cert for you to use to login to the server. If it is the client cert, and it sounds like it is, you will likely need a ca cert file also to use in validating the servers certificate in order to establish a connection. The CA certs need to go into a truststore and your client certs need

Adding certificate chain to p12(pfx) certificate

旧城冷巷雨未停 提交于 2019-11-28 21:26:09
I have aplication in java and cxf which connects to WebServices with client certificate. I got certificates form WebService owner certificate.p12 certificate.pem certificate.crt trusted_ca.cer root_ca.cer I have problem with straightforward converting this p12 certficate to working jks keystore requred by java. I did this: keytool -importkeystore -srckeystore certificate.p12 -srcstoretype PKCS12 -destkeystore certificate1.jks -deststoretype JKS -storepass secret keytool -import -alias root -file root_ca.cer -trustcacerts -keystore certificate1.jks -storepass secret keytool -import -alias