private-key

Casting private key to RSACryptoServiceProvider not working

爷,独闯天下 提交于 2019-12-10 11:24:31
问题 I have a X509Certificate2 variable and I'm trying to cast the private key of the variable to a RSACryptoServiceProvider RSACryptoServiceProvider pkey = (RSACryptoServiceProvider)cert.PrivateKey; However I get this exception. System.InvalidCastException: 'Unable to cast object of type 'System.Security.Cryptography.RSACng' to type 'System.Security.Cryptography.RSACryptoServiceProvider'.' It's weird that this happens because other answers in SO suggested the same procedure as mine but I get an

Create a RSAParamaters Object from public+private key

强颜欢笑 提交于 2019-12-10 11:13:04
问题 I need to create a RSAParameters object in .Net using a private and public key (.key and .cer file). Is it possible to do this in .Net without the use of third party software? If so, where should I be looking. I ultimately need to extract the Exponent, Modulus, D, P, Q, DP, DQ, InverseQ from this object in order to create a keyblob for a cryptoServer. Thanks! 回答1: ".key" and ".cer" file extensions are in no way an unambiguous specification of how the keys are encoded. However, it is plausible

Creation of ECDSA private key given curve and private exponent?

心不动则不痛 提交于 2019-12-10 10:52:03
问题 I am new to cryptopp and have been struggling for a while with the creation of private keys for ECDSA signing. I have a hex encoded private exponent E4A6CFB431471CFCAE491FD566D19C87082CF9FA7722D7FA24B2B3F5669DBEFB . This is stored as a string. I want to use this to sign a text block using ECDSA. My code looks a bit like this string Sig::genSignature(const string& privKeyIn, const string& messageIn) { AutoSeededRandomPool prng; ECDSA<ECP, SHA256>::PrivateKey privateKey; privateKey

Fighting with certificates: Access was not successfully obtained for the private key

时光怂恿深爱的人放手 提交于 2019-12-10 10:28:50
问题 I work in company with many servers and Pcs for developers. Servers are win2003, PC developers Windows XP. In a server Win2003 named preiis01, in preproduction environment, other people in company install a client certificate using any other user (unknown user for me) for logging in server preiis01. I use my user "domainCompany\myuser" for log in server preiis01 (using Terminal Server, Remote Desktop for Windows XP). in preiis01, I execute mmc -> Snap in -> Certificates for Local Machine. In

Extracting private key in java

陌路散爱 提交于 2019-12-10 10:15:09
问题 I have certificate created using java class CertAndKeyGen and X500Name and I am able to generate the certificate which is in byte array. Now I want the private key I used in certificate and convert it into readable format. Below is the code I used to create the certificate, CertAndKeyGen keypair = new CertAndKeyGen("RSA", "SHA1WithRSA", null); X500Name x500Name = new X500Name(commonName, organizationalUnit, organization, city, state, country); keypair.generate(keysize); PrivateKey privKey =

public key for encryption; private key for de-cryption?

守給你的承諾、 提交于 2019-12-10 09:47:01
问题 I understand that private and public keys are mathematically related and data encrypted with one key can only be decrpyted with other. My question is that private key is always used to encrypt data whereas public key is always used to de-crypt it? Or can be be vice-vera and if so can you give some example application where its used in other direction (public key to encrypt and private key to decrypt)? 回答1: It's interchangeable. Digital Signature -> Private key encrypts, public key decrypts so

How to Secure Private key(of Triple DES) in C# application?

微笑、不失礼 提交于 2019-12-09 23:59:33
问题 Tool : OS-Windows 7 64bit, Visual Studio 2012, 4.5 .NET Framework. Language : C#. I have created one console application. In this application I have used Data Encryption Algorithm (DES- Symmetric Algorithm) to encrypt and decrypt data. Now in this approach, Private or secrete key is used. I want to secure this key from client/Hack. How can I secure it? For now I have stored KEY to the registry, And read that key from registry to encryption and decryption when required. But from registry any

Read a Private Encrypted Key in Java

做~自己de王妃 提交于 2019-12-09 17:41:04
问题 I have the following piece of code: PEMParser pemParser; File telexuskeys = new File(locationKey); if(telexuskeys.exists()) pemParser = new PEMParser(new FileReader(telexuskeys)); else{ usage(ops); throw new FileNotFoundException("The key file (company's certificate) doesn't exist!"); } System.out.println("Loading company's certificate"); Object object = pemParser.readObject(); Object object2 = pemParser.readObject(); PEMDecryptorProvider decProv = new JcePEMDecryptorProviderBuilder().build

Android studio git using private key

二次信任 提交于 2019-12-09 15:45:11
问题 A have an address of git repository. Also I have a private key in open-ssh format. Is it possible for git in Android Studio to use it? I tried to search some info, but no luck at this time. Thanks for any useful information! Edit. My steps: 1. I put my private key in .ssh folder (Users/user). 2. In Android studio I run: File - Settings - Version Control - Git and put the path to Git executable. 3. Then VCS - Checkout from vesrion control - Git. I put repository address there. If I continue

How to communicate AES initialization Vector to client for hybrid cryptosystem

白昼怎懂夜的黑 提交于 2019-12-08 23:27:12
问题 I need to implemented security for client-server communication. I have implemented the following hybrid cryptosystem To encrypt a message addressed to Alice in a hybrid cryptosystem, Bob does the following: Obtains Alice's public key. Generates a fresh symmetric key for the data encapsulation scheme. Encrypts the message under the data encapsulation scheme, using the symmetric key just generated. Encrypt the symmetric key under the key encapsulation scheme, using Alice's public key. Send both