keytool

Java SSL connection with self-signed certificate without copying complete keystore to client

假如想象 提交于 2019-12-04 21:38:36
I am setting up a licensing servlet in Java together with a client app that will post request for new licenses and validate existing licenses at that server. The servlet runs in Tomcat. I've configured Tomcat so that it only allows connections to the servlet over https, and this works just fine. I have created a self-signed certificate using 'keytool -genkey -alias www.mysite.com -keyalg RSA -keystore license.store' which creates a file license.store and pointed tomcat to this keystoreFile with its password asdf1234 . When I just try to connect from the client to the servlet over https in Java

java keystore and password settings

杀马特。学长 韩版系。学妹 提交于 2019-12-04 20:42:37
问题 I have the following question on java keystores and keytool. I assume that a keystore may have more than 1 certificates. As I have tried, via keytool I can create a keystore, and to access this keystore I have to set a password. Also to access each certificate entry I have to set a password. Is it mandatory to have the same password for the keystore and the entries? If not (and I think that it is reasonable to assume so) why is the following code: char[] pwd = new char[]{'s','e','c','r','e',

Keytool usage with Runtime.getRuntime().exec() under Linux

混江龙づ霸主 提交于 2019-12-04 20:23:44
I'd like to call the java keytool during runtime execution providing dynamic arguments. Here's what is working under Windows, but not under Linux (Ubuntu) same Java 1.6.0: File f = new File("mykey.jks"); StringBuilder command = new StringBuilder(); command.append(System.getProperty("java.home") + System.getProperty("file.separator") + "bin" + System.getProperty("file.separator") + "keytool"); command.append(" -genkey"); command.append(" -dname \"cn=foo,ou=bar,o=company,c=CH\""); command.append(" -alias myProduct"); command.append(" -keypass " + "testtest"); command.append(" -keystore " + f

How to chain a SSL certificate

自闭症网瘾萝莉.ら 提交于 2019-12-04 16:46:59
Is there any way we can chain our own generated key pair with an existing certificate which has been chained to a root CA (eg: verisign)? Basically my question is described in diagram below Verisign Root CA | --> Company XYZ certificate | ---> Server foo certificate Once i've generated key pair for server foo, how do I chain it with Company XYZ cert? If Company XYZ has an Intermediate Certificate Authority certificate then you can. This kind of certificates are authorized by the root CA to issue new certificates and this fact is determined at creation time by specific properties (Basic

Unable to import .p12 certificate to cacerts

谁都会走 提交于 2019-12-04 13:55:16
While importing .p12 to cacerts I'm facing the following issue. First line says alias already exists and then when I try to overwrite it says alias not found. Please help me tackle this issue. /usr/java/default/jre/bin/keytool -importkeystore -deststorepass changeit -destkeystore /usr/java/default/jre/lib/security/cacerts -srckeystore /home/sogadm/MB_copy/MB_client.p12 -srcstoretype pkcs12 -srcstorepass 123456 -alias mb_ca Existing entry alias mb_ca exists, overwrite? [no]: yes keytool error: java.lang.Exception: Alias <mb_ca> does not exist It probably means that: in cacerts you already have

How to Encrypt/Decrypt text in a file in Java

主宰稳场 提交于 2019-12-04 13:36:39
问题 I have a problem with my code, when I encrypt data, for example, in this case, the simmetric key I encrypted with the receiver's public key, then saved to a text file, when I read that text file and try to decrypt it, using the receiver's private key, I get a different key, therefore I cannot use it to decrypt the encrypted message. Sender's code: import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStream; import java.security.KeyStore;

StartSSL class 1 certificate not accepted by browser (Weblogic 10.0.1)

非 Y 不嫁゛ 提交于 2019-12-04 11:35:24
问题 I have requested a class 1 certificate from StartSSL and installed it in Weblogic 10.0.1 (see screenshots). The browsers (Chrome & IE9 on Windows 7, IE8 on XPSP3) still give a certificate error (see screenshots). I think the StartSSL root certificate is available in several browsers (see here). Please advise. 回答1: StartSSL Class 1 certificates are signed by a intermediate CA, which is signed by the StartCom Root CA. For your browser to trust this certificate, it needs to know the trust chain

How to verify signature on self signed jar?

…衆ロ難τιáo~ 提交于 2019-12-04 10:46:21
I've signed my jar with a key that I generated using keytool. At runtime, how do I verify that the jar hasn't been modified? The goal is to use the certificate information and verify that each class in the jar has not been modified since the jar was built. This is a runtime check so the jar containing the code could be anywhere on the user's file system. The JarFile class embeds the jar verifier. This code snippet verifies the signature of all entries in an archive : JarFile jar = new JarFile("/path/to/myarchive.jar"); Enumeration<JarEntry> entries = jar.entries(); while (entries

CAS实现单点登录(sso)搭建流程 服务器端搭建

余生颓废 提交于 2019-12-04 10:22:26
一、简介 1、cas是有耶鲁大学研发的单点登录服务器 2、所用环境 · Linux系统 · Tomcat7.0 · JDK1.7 · CAS Service 版本 CAS Server 3.5.2 Release · CAS Client版本 cas-client-3.3.3-release 二、生成证书 证书对于实现此单点登录非常之重要,证书是服务器端和客户端安全通信的凭证,目前只是使用了JDK自带的证书生成工具keytool。 1、用JDK自带的keytool生成证书 keytool -genkey -alias demo -keyalg RSA -keystore /home/ Java /keys/demo 此命令是生成一个证书,其中 demo 是证书别名 此命令的执行如图所示: 其中名字与姓氏这一写你的 域名 ,如果在单击测试你可以在C:\Windows\System32\drivers\etc\hosts文件中映射一个虚拟域名, 注意不要写 IP 。 结果可以在/home/java/keys文件夹下生产demo文件,刚才输入的密码为1qaz2wsx 2、导出证书 keytool -export -file/home/java/keys/demo.crt -alias demo -keystore /home/java/keys/demo

docker+cas-overlay集成

浪子不回头ぞ 提交于 2019-12-04 10:18:16
CAS cas官网可参考:https://www.apereo.org/projects/cas cas是中央认证服务器,跨平台的客户端支持,包括JAVA,NET,PHP,Perl...并支持多种协议,是一个友好的开源的项目,为WEB系统提供了单点登陆的解决方法。 以下是截取自官司网的架构图,可参考。通过图中,可以看到,我们在自己的WEB应用中集成CAS Client,然后可以通过协议调用CAS Server端的应用,进行票据获取和认证,认证可以通过LDAP或数据据等处理获取。 Overlay是什么 Overlay参考:http://www.cassso-china.cn/apereo_github_cas_5.2/apereo.github.io/cas/5.2.x/installation/Maven-Overlay-Installation.html?tdsourcetag=s_pctim_aiomsg Overlays是一种避免重复代码或重复资源的打包策略,它可以让你自行下载CAS预编译的应用后,自定义增加或者替换相应的配置和特性。在构建的时候,Maven/Gradle首先会自动下载更新安装,然后找到你的配置文件和设置,自动合并到你自动下载的目录结构中,来构建出一个完整的项目 (比如 cas.war)。重写或覆盖的文件包括资源文件、Java的classes文件、图像文件