pem

Sign string with PEM PrivateKey

匿名 (未验证) 提交于 2019-12-03 08:48:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a PEM-encoded private key and I need to sign a string with it. But the code keeps crashing with exception: java.security.spec.InvalidKeySpecException: java.lang.RuntimeException: error:0c0890ba:ASN.1 encoding routines:asn1_check_tlen:WRONG_TAG the key string: -----BEGIN ENCRYPTED PRIVATE KEY----- MIICxjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQI4P/+9mJV6RwCAggA MBQGCCqGSIb3DQMHBAg/ZWGXeLHgeASCAoAhExhFxfcikmIKbFP0rgAlJuj1r999 ... and so on... hlgzM2p71FdC6NDVyyxbit/IzbimtJyhkRwOAnZ98yqtXWUEOx2v7CcUqiU8dSLA K0PsaxNTUeUcQV+Z7yJk

Programmatically verify a X509 certificate and private key match

匿名 (未验证) 提交于 2019-12-03 08:46:08
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I created an RSA key pair using the EVP_aes_256_cbc() cipher. The private key is PEM encoded and has a passphrase. This requires a passphrase to be entered by the user. Here's the create private key call: //Save private key bio_priv = BIO_new_file(full_asymKeyFilePath.c_str(), "a+"); if (PEM_write_bio_RSAPrivateKey( bio_priv, //BIO handle rsa, //Key handle EVP_aes_256_cbc(), //Cipher encoding format pwd, //Password pwd_len, //Password length NULL, //Callback NULL //Not sure ) != 1) { //report err } Then I generated a certificate and signed

haproxy - unable to load SSL private key from PEM file

匿名 (未验证) 提交于 2019-12-03 08:33:39
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: haproxy does not start anymore, it shows the error bind <ip>:443' : unable to load SSL private key from PEM file ... We did not change anything on the certificates or configuration. Since the last start we only made normal updates to the system. To find the error, I generated a completely new certificate (self signed) but the error still exists. This is the structure of the PEM file: -----BEGIN CERTIFICATE----- MIIDXjCCAkY... -----END CERTIFICATE----- -----BEGIN RSA PRIVATE KEY----- MIIEpgIBAAKC.... -----END RSA PRIVATE KEY----- I also tried

Keep getting Could not read CA certificate when trying to start docker

被刻印的时光 ゝ 提交于 2019-12-03 05:29:31
I am attempting to migrate from boot2docker to docker-machine. I followed the directions here to install docker but I keep getting the following message: Could not read CA certificate "/Users/<useraccountfolder>/.boot2docker/certs/boot2docker-vm/ca.pem": open /Users/<useraccountfolder>/.boot2docker/certs/boot2docker-vm/ca.pem: no such file or directory when I run most any docker command. Naruto Sempai I found my solution here I needed to update my .bash_profile to look like: export DOCKER_HOST=tcp://192.168.99.100:2376 export DOCKER_MACHINE_NAME=default export DOCKER_TLS_VERIFY=1 export DOCKER

Go Language Convert Modulus exponent to X.509 certificate

孤人 提交于 2019-12-03 04:53:11
I have seen a lot of examples of how to convert a X.509 to Exponent Modulus, but I have not seen the reverse. The values I have from my key endpoint look like this: {"keys": [{"alg":"RS256","e":"AQAB","n":"ok6rvXu95337IxsDXrKzlIqw_I_zPDG8JyEw2CTOtNMoDi1QzpXQVMGj2snNEmvNYaCTmFf51I-EDgeFLLexr40jzBXlg72quV4aw4yiNuxkigW0gMA92OmaT2jMRIdDZM8mVokoxyPfLub2YnXHFq0XuUUgkX_TlutVhgGbyPN0M12teYZtMYo2AUzIRggONhHvnibHP0CPWDjCwSfp3On1Recn4DPxbn3DuGslF2myalmCtkujNcrhHLhwYPP-yZFb8e0XSNTcQvXaQxAqmnWH6NXcOtaeWMQe43PNTAyNinhndgI8ozG3Hz-1NzHssDH_yk6UYFSszhDbWAzyqw","kid":"wyMwK4A6CL9Qw11uofVeyQ119XyX-xykymkkXygZ5OM

Apache HttpClient and PEM certificate files

与世无争的帅哥 提交于 2019-12-03 04:05:25
I'd like to programmatically access a site that requires Client certificates, which I have in PEM files. In this application I don't want to add them to my keystore, use keytool, or openssl if I can avoid doing so. I need to deal with them directly in code. HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet("https://my.secure.site.com/url"); // TODO: Specify ca.pem and client.pem here? HttpResponse response = httpclient.execute(httpget); HttpEntity entity = response.getEntity(); if (entity != null) { entity.consumeContent(); } httpclient.getConnectionManager()

Convert .p12 file to .pem using Terminal app in Mac “No such file or directory” error?

守給你的承諾、 提交于 2019-12-03 03:54:52
问题 I have export the "Apple Development IOS Push Service" certificate from Keychain Access and save the "apns-dev-cert.p12" in my desktop. I want to enable Apple Push Notification I have followed these blogs to convert apns-dev-cert.p12 to apns-dev-cert.pem from Terminal app, http://bhaveshkumbhani.blogspot.in/2011/12/convert-p12-to-pem-for-apns.html http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12 Apple Document RemoteNotificationPG.pdf I have used these

Convert SSL .pem to .p12 with or without OpenSSL

做~自己de王妃 提交于 2019-12-03 03:53:18
问题 I get external .pem files that need to be converted to .p12 files - I add a username and password in the process. (I need to do this to utilize a third party API.) Using openssl , the command is... openssl pkcs12 -export -in xxxx.pem -inkey xxxx.pem -out xxx.p12 -passout pas:newpassword -name "newname" I can run this from a terminal session and it works perfectly. However, I will need to do this often and have written a Java class that handles this and more (my application is mostly .jsp with

How to build a SSLSocketFactory from PEM certificate and key without converting to keystore?

删除回忆录丶 提交于 2019-12-03 03:37:05
I'm given a self-signed client certificate kit that is to be used to access a server via HTTPS. The kit consists of the following PEM files: client.crt (client certificate) client.key (client private key) ca.crt (CA certificate) One way to solve the task is to generate a Java keystore: Use openssl to convert client certificate and key to PKCS12 keystore Use keytool to import CA certificate to the store ... and then use code like the following to build SSLSocketFactory instance: InputStream stream = new ByteArrayInputStream(pksData); KeyStore keyStore = KeyStore.getInstance("PKCS12"); keyStore

PEM to PublicKey in Android

六眼飞鱼酱① 提交于 2019-12-03 03:26:33
I've seen a number of similar questions, but nothing has quite worked for me. I am simply trying to convert an RSA public key that's in PEM format that I've retrieved from a server into a PublicKey in Android. Can anyone point me in the right direction? EDIT: I've successfully used the following code to convert the PEM into a PublicKey, but upon encoding a message, I get unexpected output... public PublicKey getFromString(String keystr) throws Exception { // Remove the first and last lines String pubKeyPEM = keystr.replace("-----BEGIN PUBLIC KEY-----\n", ""); pubKeyPEM = pubKeyPEM.replace("---