private-key

Decrypt with PrivateKey X.509 Certificate

爷,独闯天下 提交于 2019-12-19 02:47:47
问题 I have a problem to decrypt a message usgin X.509 Certificate. I generate my certificate with makecert with this options: makecert -r -pe -n "CN=MyCertificate" -ss CA -sr CurrentUser -a sha1 -sky signature -cy authority -sv CA.pvk CA.cer And the PrivateKey was "mypassword". My problem is when I want to decrypt a message encrypt with previous certificate in c#. I found this class http://blog.shutupandcode.net/?p=660, but in the X509Decrypt method allways the PrivateKey is null. public static

c# RSA extract public key from private key

不羁岁月 提交于 2019-12-18 09:00:26
问题 Is there a way to extract public key from private key in c#? Becouse if i do ToXMLString() then i can set if i want public key information saved with the private key. So now im thinking that is there a way to extract public key from private? 回答1: The normal private key format for RSA includes the public key (the "public exponent" is useful for implementation of private key operations in a way which resists timing attacks). Therefore, it is possible to extract the public key from the private

KeyVault generated certificate with exportable private key

折月煮酒 提交于 2019-12-17 22:54:10
问题 I'm attempting to create a self signed certificate in KeyVault using the "Self" issuer. $policy = New-AzureKeyVaultCertificatePolicy -SubjectName "CN=$($certificateName)" -IssuerName "Self" -ValidityInMonths 12 $policy.Exportable = $true Add-AzureKeyVaultCertificate -VaultName $vaultName -Name $certificateName -CertificatePolicy $policy However, when getting the certificate back it doesn't appear to have a private key. Creating certificates directly in KeyVault doesn't seem hugely covered

Differences between “BEGIN RSA PRIVATE KEY” and “BEGIN PRIVATE KEY”

狂风中的少年 提交于 2019-12-17 02:42:08
问题 Hi I was writing a program that imports private keys from a .pem file and create a private key object to use it later.. the problem I have faced is that some pem files header begin with -----BEGIN PRIVATE KEY----- while others begin with -----BEGIN RSA PRIVATE KEY----- through my search I knew that the first ones are PKCS#8 formatted but I couldn't know what format does the other one belongs to. 回答1: See https://polarssl.org/kb/cryptography/asn1-key-structures-in-der-and-pem (search the page

Secure FTP using private key authentication in java

流过昼夜 提交于 2019-12-13 07:24:45
问题 import com.jcraft.jsch.*; import com.jcraft.jsch.JSchException; import oracle.jdbc.driver.OracleDriver; import java.io.*; import java.util.*; import java.sql.*; import java.net.*; public class SecureFTP { public static void main(String[] args) throws IOException , ClassNotFoundException, JSchException, SftpException{ JSch jsch = new JSch(); File file = new File("/home/xxxxx/.ssh/id_rsa"); Session session = null; URL keyFileURL = null; URI keyFileURI = null; if (file.exists()) { keyFileURL =

PHP / Bash: Creating PPK out of OpenSSH Key with passphrase

巧了我就是萌 提交于 2019-12-12 10:26:30
问题 I would like to create a php script that creates keys for ssh-authentication. I've started with a exec("ssh-keygen -b 1024 -t dsa -N *pwd* -f *path-to-file* -q"); to create the private and public-key-pair. No problem till here ;) Now I've to convert the OpenSSL-Key to the ppk-format of PuTTY (in the cmd, not in the GUI). If anyone have an Idea on how to manage that, please let me know. Thanks 回答1: If you were working with RSA keys you could do this (requires phpseclib): <?php include('Crypt

Cannot Export PrivateKey Before Import Using RSACng and RsaParameter

て烟熏妆下的殇ゞ 提交于 2019-12-12 10:19:42
问题 the next unit test export a privatekey and save it in bytes arrays using the rsa instance then encrypt the "hi" message, all is fine here, but the problem occur when It make rsa2 instance and import the previous privatekey in RSAParameter, then message can be decrypt after import privatekey, but It throw exception when you try to export privatekey of rsa2. Please could you tell me why It can't extract Imported Private key [TestMethod] public void TestRsa() { var rsa = new RSACng(2048); //

URL Signing with HMAC or OpenSSL

本秂侑毒 提交于 2019-12-12 08:33:23
问题 I'm interested in url signing (e.g. http://.../?somearg=value&anotherarg=anothervalue&sig=aSKS9F3KL5xc), but I have a few requirements which have left me without a solution yet. I'll be using either PHP or Python for pages, so I'll need to be able to sign and verify a signature using one of the two. My plan was to use a priv/pub key scheme to sign some data, and be able to verify that the signature is valid, but here's where it gets complicated: The data is not known when the verification is

Exception when trying to read a PrivateKey from Windows certstore

可紊 提交于 2019-12-12 07:15:55
问题 I created a private and public key pair using OpenSSL and then I generated a .p12 file to import it into my Windows certstore. The key pair and .p12 files were created in Windows XP and I am trying to use it in Windows 7. I am trying to access the key from within a Web Service (.svc) in IIS. If I try to read the private key from a standalone app, I can do it without any problems, but when I try to read it from my web app, I always get the following exception: 'cert.PrivateKey' threw an

Check that a file is certificate or a key

拥有回忆 提交于 2019-12-12 07:07:29
问题 I have a problem, I am allowing the used to upload certificate and private key files. Now suppose I have a file whose extension is messed-up (changed knowingly or unknowingly) say to break the system.. I need to put a validation in place that can check and can tell me that the given file is a valid certificate file or private key file or some other file.. What i was thing was : to check for -- BEGIN CERTIFICATE -- , -- BEGIN RSA PRIVATE KEY -- in the file content.. Please tell what I am thing