public-key

Using AsymmetricAlgorithm Private and Public key with RSA C#

早过忘川 提交于 2019-11-30 15:24:32
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 that I want to use keys that I already have? #region "RSA Encrypt/Decrypt" public string RSAEncrypt(string str, string publicKey) { //---Creates a new instance of RSACryptoServiceProvider--- try { RSACryptoServiceProvider RSA = new RSACryptoServiceProvider(); //--

Can you help me get my head around openssl public key encryption with rsa.h in c++?

亡梦爱人 提交于 2019-11-30 13:09:03
I am trying to get my head around public key encryption using the openssl implementation of rsa in C++. Can you help? So far these are my thoughts (please do correct if necessary) Alice is connected to Bob over a network Alice and Bob want secure communications Alice generates a public / private key pair and sends public key to Bob Bob receives public key and encrypts a randomly generated symmetric cypher key (e.g. blowfish) with the public key and sends the result to Alice Alice decrypts the ciphertext with the originally generated private key and obtains the symmetric blowfish key Alice and

Decrypt data using an RSA public key

拥有回忆 提交于 2019-11-30 09:34:06
问题 First off, that is not a typo, I want to decrypt using a public key. The purpose for doing this is to challenge a third party to ensure they do, in fact, have the private key that corresponds to the public key. Basically, I would send some random data, they would encrypt it with their private key, I would decrypt it using the public key and compare the decrypted value to the random data that I sent. I believe this is a pretty standard procedure in public key crypto but for some reason

Given a Java ssh-rsa PublicKey, how can I build an SSH2 public key?

混江龙づ霸主 提交于 2019-11-30 07:52:45
I'm doing publicKey.getEncoded(), then appending "ssh-rsa" to the front, then base64 encoding it. Then I add the SSH2 header/footer. But it won't decode... erickson Java public keys are encoded as a standard X.509 SubjectPublicKeyInfo structure. SSH2 uses its own simple format. Base-64 encode the result of the encode method shown below, and affix the necessary SSH2 header and footer. public static byte[] encode(RSAPublicKey key) throws IOException { ByteArrayOutputStream buf = new ByteArrayOutputStream(); byte[] name = "ssh-rsa".getBytes("US-ASCII"); write(name, buf); write(key

How to create a X509 certificate using Java?

折月煮酒 提交于 2019-11-30 07:10:37
问题 I want to create a X509 certificate using Java language and then extract public key from it. I have searched the internet and found many code examples, but all of them have errors (unknown variable or unknown type) or have many warnings that say something like : "the method ... from type ... is deprecated " etc. For example, why the following code doesn't work: PublicKey pk; CertificateFactory cf = CertificateFactory.getInstance("X.509"); String PKstr = pk.toString(); InputStream PKstream =

how does public key cryptography work [duplicate]

青春壹個敷衍的年華 提交于 2019-11-30 07:09:25
This question already has an answer here: Whose key is used to encrypt a HTTPS response? 3 answers What I understand about RSA is that Alice can create a public and a private key combination, and then send the public key over to Bob. And then afterward Bob can encrypt something using the public key and Alice will use the public and private key combo to decrypt it. However, how can Alice encrypt something to be sent over to Bob? How would Bob decrypt it? I ask because I'm curious how when I log onto my banking site, my bank sends me data such as my online statements. How does my browser decrypt

Use and utility of .p12 certificate/file

柔情痞子 提交于 2019-11-30 06:46:00
What is the utility of .p12 file/certificate? I am not getting any correct definition when searching the internet: In one site I got "it stores server side certificates along with intermediate certificates and private key in one file. Its mostly used in Windows Machine" In another site i got "it binds a organizations public key with its name. My question is whether its public key or private key which is included in the .p12 certificate. The .p12 contains both the private and the public key, and also information about the owner (name, email address, etc. ) all being certified by a third party.

How do I read the public key from a signed C# exe

做~自己de王妃 提交于 2019-11-30 04:25:11
问题 I'm signing a dot net exe using signcode.exe with an spc/pvk combo The file needs to read its own Public Key at runtime in order to verify some data. I've gone down a number of different avenues. I've tried X509Certificate executingCert = X509Certificate.CreateFromSignedFile(exe); executingCert is then null. I'm guessing signcode isn't creating an X509 signed file, though if there's a switch to change that I'm happy to go that way. edited Turns out the above does work.... I had my null check

SSHJ Example of Public Key Auth from File

橙三吉。 提交于 2019-11-30 04:20:06
问题 Can someone give me an example of using SSHJ for Public Key Authentication? I realise this question is essentially identical to ssh example of private/public key authentication, however the answer by the author https://stackoverflow.com/users/126346/shikhar refers to a google user group that no longer exists, and I am having trouble getting it to work. Thanks! Phil 回答1: We built the overthere framework on top of SSHJ. Which can connect also connect using key files. The following piece of code

How to load public certificate from pem file?

江枫思渺然 提交于 2019-11-30 02:00:08
I was trying to extract RES public key from the file below -----BEGIN CERTIFICATE----- MIIGwTCCBamgAwIBAgIQDlV4zznmQiVeF45Ipc0k7DANBgkqhkiG9w0BAQUFADBmMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSUwIwYDVQQDExxEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBDQS0zMB4XDTEyMTAzMDAwMDAwMFoXDTE1MTEwNDEyMDAwMFowgYIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQIEwVUZXhhczEQMA4GA1UEBxMHSG91c3RvbjEpMCcGA1UEChMgVmFsZXJ1cyBDb21wcmVzc2lvbiBTZXJ2aWNlcywgTFAxCzAJBgNVBAsTAklUMRkwFwYDVQQDDBAqLnZhbGVydXMtY28uY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1GR2NKV9GwVHBtpvgBUdVVbd6qeh6aKOS