privatekey

How to extract the private key from an snk file

Hello. I am trying to have my application (C# under .NET 3.51 SP1) recognize that a file has come from a "safe" source. My approach was I would sign the application and then, at a later date, I would use the private key from the same snk file to sign files. The application would use the public key (easily obtainable) and calculate if t...

Import .pem public and private keys to JKS keystore

Hi, I have public and private keys in separate .pem files that I would need to get into a JKS keystore somehow. Tried using the -import command in KeyTool for this, which gives an "not an X.509 certificate" error. I'm guessing the solution has to do with OpenSSL, but I'm not entirely sure what to do with it. Would really appreciate a...

What exactly is a "key container"?

Is it something specific, with a definite structure, or just an arbitrary data file with some form of encryption to hold keys, and potentially other secret information? Can someone please explain the term or point me to a link. ...

How to read a password encrypted key with java?

Hi, I have private key stored in file in PKCS8 DER format and protected by password. What is the easiest way to read it? Here is the code I use to load unencrypted one: InputStream in = new FileInputStream(privateKeyFilename); byte[] privateKeydata = new byte[in.available()]; in.read(privateKeydata); in.close(); KeyFactory privateKey...

Is web.config more secure than a class?

I was reading a tutorial on ASP.NET and third party API's and it mentioned that the API KEY and SECRET KEY should be stored in the web.config file, for security on production servers, instead of in the classes that use them. However, I'm not quite sure what's more secure about a web.config file than a class? I understand the convenience ...

Meet-in-the-Middle Atack on an NTRU Private key

Hello everyone. I was wondering if anyone could tell me how to represent the enumeration of vectors of privite key f in a Meet-In-the-Middle Attack on an NTRU Private key. I can not understand the example, given here http://securityinnovation.com/cryptolab/pdf/NTRUTech004v2.pdf I'll be very thankful if anyone could show an example in det...

how do i convert RSAParameters from .net to .pem file so i can use it in php

Hello i have a private and public keys for RSA generated in .net in this format string privateKey = "<RSAKeyValue>" + "<Modulus>...kCFhsjB4xMW49mrx5B/Ga...</Modulus>" + "<Exponent>...</Exponent>" + "<P>...7bRCrQVgVIfXdTIH3iY8x...</P>" + ...

IIS 6 Private Key certificate access

Hi, We have a Web asp.net application running in the framework 2.0 and hosted in an IIS 6 server, and the OS is windows server 2003. The web application is suing a client certificate to be authenticated by a web service. We have impersonalized the application pool with de user “Network Service”. The problem is when we have to access...

Is there a public / private key encryption scheme that will not change a message's length?

Is there a public / private key encryption scheme that will not change a message's length? I would like to encrypt a message one packet at a time, but if the packet grows, it would no longer just be one packet long. ...

How to convert PKCS#8-formatted PEM private key to the tranditional format?

Hi all, From OpenSSL 1.0 change log: Make PKCS#8 the default write format for private keys, replacing the traditional format. This form is standardised, more secure and doesn't include an implicit MD5 dependency. [Steve Henson] However, I need the private key file in the previous, traditional format. Is it po...

Load Java KeyStore for one alias?

Does anyone know if it is possible to load a KeyStore so that it only prompts for the password for the given alias? Example: In my key store i have two private keys: Alice's Encryption Certificate and Bob's Encryption Certificate. When i load my key store: keyStore = KeyStore.getInstance("Windows-MY", "SunMSCAPI"); keyStore.load(null...

Confused about encryption with public and private keys (which to use for encryption)

I am making a licensing system when clients ask my server for a license and I send them a license if they are permitted to have one. On my current system I encrypt the license using a single private key and have the public key embedded into the client application that they use to decrypt the license. It works! Others have told me that...

OpenSSL.NET can't export private key with null Cipher

I've recently discovered OpenSSL.NET and it's a pretty sweet little wrapper. I'm trying to execute the following code: public static void DoSomething(byte[] buf) { OpenSSL.Core.BIO input = new OpenSSL.Core.BIO(buf); OpenSSL.X509.X509Certificate b = OpenSSL.X509.X509Certificate.FromPKCS12(input, "passphrase"); ...

How do I store a Java KeyStore password?

In my web application I access a private key that is stored in a Java KeyStore. I would like to know what is the best/recommended way to store the password for the KeyStore and private key. I've considered using a properties file but that does not seem very secure for use in a production environment (storing password in a plain text fil...

How to add PrivateKeyUsage extension to a certificate using bouncycastle in java?

i have an X509Certificate that i want to add extensions to... i want to add the PrivateKeyUsage extension, but i dont know how to create a PrivateKeyUsage object or how to give it notBefore & notAfter values ... thanks ...

Using AsymmetricAlgorithm Private and Public key with RSA C#

I have two AsymmetricAlgorithm objects that contain an RSA Private and RSA Public key. The private key was retrieved out of the Windows-MY keystore and the Public key from a user's certificate. How can I use these keys along with RSACryptoServiceProvider to encrypt data using the RSA algorithm in C#? In other words, how can I specify tha...

Get Private Key from BouncyCastle X509 Certificate? C#

Normally when I grab an X509Certificate2 out of my keystore I can call .PrivateKey to retrieve the cert's private key as an AsymmetricAlgorithm. However I have decided to use Bouncy Castle and its instance of X509Certificate only has a getPublicKey(); I cannot see a way to get the private key out of the cert. Any ideas? I get the an X50...

BouncyCastle create AsymmetricCipherKeyPair from existing keys?

I have two AssymetricAlgorithm RSA keys that I have pulled out of a certificate that was in my keystore. One is the Public Key and the other the Private. Is there a way of getting this keypair into a BouncyCastle AsymmetricCipherKeyPair? BouncyCastle's AsymmetricCipherKeyPair expects a public and private AsymmetricKeyParameter however I ...

OpenSSL SSL_CTX_use_PrivateKey_file with Windows certificate store

Hi, I have a native C++ library which uses OpenSSL for TLS. It reads the private key using SSL_CTX_use_PrivateKey_file and everything is fine, Then I created a C# wrapper which reads the certificates from Windows certificate store according to certain OIDs and the subject name. And here is the problem - I might get more than one certifi...

iPhone SDK 4.0: Get publicKey and privateKey from a certificate / identity profile stored in KeyChain

Hello Community I am trying to get the public and private Key from a certificate which i have already installed on the iPhone. (It is shown unter Settings -> General -> Profiles) I need this keys for encryption sensitive data. (RSA Algorithm) Up to now i have found no way to get access to the keys. Is it even possible ? If not: What...