key-pair

can't import .p12 file into MS Certificate Store

荒凉一梦 提交于 2019-12-25 04:54:05
问题 I have the following test code to create test PKCS#12 keystore: X509Certificate[] chain = new X509Certificate[1]; long currentTime = new Date().getTime(); Date firstDate = new Date(currentTime - 24 * 60 * 60 * 1000); long validity = (long) 30 * 24 * 60 * 60 * 365; Date lastDate = new Date(currentTime + validity * 1000); String myName = "CN=TestKeys, L=Test, C=US"; X509V3CertificateGenerator cg = new X509V3CertificateGenerator(); cg.setSerialNumber(BigInteger.valueOf(firstDate.getTime())); cg

java.security.InvalidKeyException: Illegal key size or default parameters

筅森魡賤 提交于 2019-12-22 01:21:00
问题 I am creating a method to generate a key pair.I need to secure the private key with a password.My code works fine except that it gives me java.security.InvalidKeyException: Illegal key size or default parameters error. When i searched the cause of the error,it says to replace the policy jars in jre/lib/security folder with unlimited access files for the same.I have jdk7 installed and i downloaded the policy files and replaced that the lib/security folder.But the error remains the same.Here is

java.lang.IllegalArgumentException: string curve25519 not an OID bouncycastle 1.52

亡梦爱人 提交于 2019-12-21 05:40:53
问题 I'm trying to generate a key pair using the /java bouncy castle 1.52 implementation for curve 25519 what gives me java.lang.IllegalArgumentException: string curve25519 not an OID Here is my code: public KeyPair generateKeys() throws NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException { ECParameterSpec ecSpec = ECNamedCurveTable.getParameterSpec("curve25519"); KeyPairGenerator g = KeyPairGenerator.getInstance("ECDSA", "BC"); g.initialize(ecSpec, new

JSch SFTP security with session.setConfig(“StrictHostKeyChecking”, “no”);

柔情痞子 提交于 2019-12-17 09:57:49
问题 I use JSch with private key to FTP file jsch.addIdentity(privatekeyfile); Session session = jsch.getSession( "user", "domain.com" ,22); session.setConfig("StrictHostKeyChecking", "no"); Line 3 is in question. Without this line, JSch does not work. My question is: Will line 3 make SFTP transfer insecure? 回答1: Disabling the StrictHostKeyChecking option will make the connection less secure than having the option enabled, because it will let you connect to remote servers without verifying their

How to encrypt serializable objects

痴心易碎 提交于 2019-12-14 03:06:25
问题 I'm currently working on a client-server application in Java. Due to the requirements for the application I need to encrypt the traffic between client and server and decided to use a hybrid encryption approach where the server generates a public/private RSA key pair and the client generates an AES session key which will be encrypted using the RSA public key. As I'm completely new to encryption in Java I didn't start implementing it directly into my application so I don't crash anything. I set

java.security.spec.InvalidKeySpecException: java.io.IOException: unexpected end-of-contents marker

别说谁变了你拦得住时间么 提交于 2019-12-12 03:33:34
问题 I'm trying to convert a .pub file's contents to a PublicKey and then convert the PublicKey back into a String in order to determine if the conversion is working and does not change the key in the process. id_rsa.pub : ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0zszKhcZTC8xJidUszmRn4Tr/FxPs04wpCzEstebfTW7Bvqgtt+OdvxoNyYM0LAEnxEF4XhAWcsX7VJJqstZLpDqlKDXFr2d0aVIjksCpZt+ftVRwYHRoERhEOP/UmPFb5rKIkhQbED2kTWg11mW9soc6BhwB3THn/Cyo3t1u2vWjEySgPhKeA3Xzh+5eqV7CUD8V6S7OAT7T9ijf7sRV0R8rwHgTLWJ8

Generate KeyPair with RandomSecure

别来无恙 提交于 2019-12-11 01:18:56
问题 Is there anyway I can generate always the same private key? I tired to initialize KeyPairGenerator with a RandomSecure object which uses the same seed : private PrivateKey getPrivateKey(String seed) { try { SecureRandom sr = new SecureRandom(seed.getBytes()); KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA"); keyGen.initialize(1024, sr); KeyPair keyPair = keyGen.generateKeyPair(); return keyPair.getPrivate(); } catch (NoSuchAlgorithmException e) { System.out.println("Failed to

AWS EC2 Key Pair setup

雨燕双飞 提交于 2019-12-10 11:45:16
问题 I'm trying to setup my AWS EC2 Instance with a Key Pair that I just created. The original instance was already setup without a key pair, so I'm trying to Launch a new Instance and set the Key Pair during that process. AWS docs instruct to "Specify the new key pair that you created" after I select the AMI, but I do not see anywhere that I can do this during the creation process. So, either I'm really clueless or something is not showing up correctly in the AWS creation steps (probably the

AWS EC2 Key Pair setup

半世苍凉 提交于 2019-12-09 03:30:31
I'm trying to setup my AWS EC2 Instance with a Key Pair that I just created. The original instance was already setup without a key pair, so I'm trying to Launch a new Instance and set the Key Pair during that process. AWS docs instruct to "Specify the new key pair that you created" after I select the AMI, but I do not see anywhere that I can do this during the creation process. So, either I'm really clueless or something is not showing up correctly in the AWS creation steps (probably the former). Instance: t1.micro AMI: Amazon Linux AMI 2013.09 Ports: 80 and 22 Forgive me if I'm not including

kSecAttrKeyTypeEC swift

我的未来我决定 提交于 2019-12-08 07:04:35
问题 I try to get sha384 with ECDSA keys. I follow up with this article: https://digitalleaves.com/blog/2015/10/asymmetric-cryptography-in-swift/?replytocom=52690#respond but I change RSA to EC, of course. and keys are generated, but encryptMessageWithPublicKey doesn't work :( Variable "status" in method: encryptMessageWithPublicKey return -50 ... Here is my code: import UIKit import Security private let _singletonInstance = AsymmetricCryptoManager() private let