private-key

RSA: Private key calculation with Extended Euclidean Algorithm

為{幸葍}努か 提交于 2019-12-03 09:50:57
I'm a high school student writing a paper on RSA, and I'm doing an example with some very small prime numbers. I understand how the system works, but I can't for the life of me calculate the private key using the extended euclidean algorithm. Here's what I have done so far: I have chosen the prime numbers p=37 and q=89 and calculated N=3293 I have calculated (p-1)(q-1)=3168 I have chosen a number e so that e and 3168 are relatively prime. I'm checking this with the standard euclidean algorithm, and that works very well. My e=25 Now I just have to calculate the private key d, which should

Amazon EC2 lost private key, how to get access to the server? [closed]

荒凉一梦 提交于 2019-12-03 09:50:47
My computer was stolen the day before yesterday, and I put one of my servers private key in that, the key is password protected, so it should be OK. But the problem is that now I can not access the server. The server is Ubuntu, Amazon EC2, Root Device: Instance Store. I've been searching this for a whole day, looks like if the server is EBS, then it will be easier to just create an image and launch a new instance. But unfortunately mine is not. I really hope that some one can give me an advise on how to get access to the server, my user type is root, so no one else can modify the key for me. I

How to implement OpenSSL functionality in Python?

不打扰是莪最后的温柔 提交于 2019-12-03 09:11:33
问题 I would like to encrypt a secret text by public-key and decrypt it by private-key in Python. I can achieve that with the openssl command: echo "secrettext/2011/09/14 22:57:23" | openssl rsautl -encrypt -pubin -inkey public.pem | base64 data.cry base64 -D data.cry | openssl rsautl -decrypt -inkey private.pem How would one implement that in Python? 回答1: Encrypt #!/usr/bin/env python import fileinput from M2Crypto import RSA rsa = RSA.load_pub_key("public.pem") ctxt = rsa.public_encrypt

Create PrivateKey and PublicKey from a String base64 encoding with DER format

自闭症网瘾萝莉.ら 提交于 2019-12-03 09:04:08
问题 I have my Private and Public keys in a String in base64 which where encoded using ANS1 DER. I tried creating the instance of a java PrivateKey and PublicKey : byte [] llave2 = DatatypeConverter.parseBase64Binary(key); PKCS8Key pkcs8 = new PKCS8Key( llave2, password.toCharArray()); //line 2 llave2 = pkcs8.getDecryptedBytes(); //line 3 certificado = DatatypeConverter.parseBase64Binary(cer); KeyFactory kf = KeyFactory.getInstance("RSA"); PKCS8EncodedKeySpec ks = new PKCS8EncodedKeySpec(llave2);

Calculating VS_KEY container name

我的梦境 提交于 2019-12-03 08:58:18
How does one calculate VS_KEY container name? They are generally something like this: VS_KEY_71E582524B5DDE29. I'm assuming it's based on computer name but what if we have a cloud service running that changes the computer name randomly every time the instance restarts? We need to have the container name when the instance goes up so we know what container to store our private keys into so build tools and all work as they should. We need to automatically set the container name. So basically we need to figure out a way to generate correct container name every time the computer reboots. Any tips

RSA 2048 Encryption Decryption - Exception

给你一囗甜甜゛ 提交于 2019-12-03 08:57:07
I am trying to encrypt and decrypt the data with RSA 2048. We have one public key and private key and will be using same throughout. but the problem is, when I decrypt, I am getting javax.crypto.BadPaddingException: Data must start with zero File file = new File("C:\\temp-ldi\\pubkey.txt"); FileWriter writer = new FileWriter(file); file.createNewFile(); encryptedText = RSACrypto.encrypt("PLAIN TEXT"); //no argument of pub-key, generate key pair writer.write(new BASE64Encoder().encode(RSACrypto.pubKeyToBytes(RSACrypto.publicKey))); writer.close(); file = new File("C:\\temp-ldi\\privkey.txt");

Java: How can I generate PrivateKey from a string?

我的梦境 提交于 2019-12-03 08:33:49
问题 I am trying to encode a message with SH1 RSA but I have no experience with security subject except some base information about RSA . I have been given a private key as String . I have managed to write following code block to do the job but I am not sure if I am doing the job securely and correctly. I am not an expert but putting my private key as String in code is not secure I guess. Can anyone guide me? String privateKeyString = "mykeyhere..."; byte[] privateKeyBytes = privateKeyString

Can a public key have a different length (encryption) than the private key?

我与影子孤独终老i 提交于 2019-12-03 08:04:16
I have a 1024 bits private key, and use it to generate a public key. Does that automatically mean that my public key also has 1024 encryption? Or can it be of a lesser encryption size? (512, 256...) PS: What i'm mostly interested in, and talking about, is the size of the modulus ("n") in RSA keys. The size is typically 1024 or 2048 bits. But I'm glad to see that this sparked a discussion, and all this is feeding my interest in cryptography. No. The public key in a key pair always matches the private key size, in fact it is derived from the private key. However, with some public key

Location of container for public and private keys in Windows?

烈酒焚心 提交于 2019-12-03 06:22:06
I am trying to store my public and private keys in a container using following code: CspParameters cp = new CspParameters(); cp.KeyContainerName = "Test"; RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(cp); What I'd like to know is the location of the container. Is the location of the container in the file system? Joe You'll find the key files in the following directory (*): Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), @"Microsoft\Crypto\RSA\MachineKeys") You can get the filename for a given key as follows: CspParameters cp = ...;

Paramiko — using encrypted private key file on OS X

倾然丶 夕夏残阳落幕 提交于 2019-12-03 04:58:57
I'm trying to use Paramiko to connect to an SSH server from Python. This is what I tried so far: >>> import paramiko >>> import os >>> privatekeyfile = os.path.expanduser('~/.ssh/id_rsa') >>> mykey = paramiko.RSAKey.from_private_key_file(privatekeyfile) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/paramiko/pkey.py", line 198, in from_private_key_file key = cls(filename=filename, password=password) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages