public-key-encryption

RSA-OAEP SHA-512 Encrypt / Decrypt from Javascriptwebcrypt api to PHP openssl?

痴心易碎 提交于 2021-02-18 16:57:51
问题 I've been rather busy trying to get a secure exchange established between a browserclient, using the webcrypto api and PHP server using openssl. I've broken down things as much as I can. I wrote some javascript to generate a keypair, print out the values private and public, encrypt a simple string and print it out as well. I've copied the values straight to a simple php script. Trying to decode it with the values from the javascipt. Encoding and decoding works properly in the javascript (as

C# RSA Import Public Key

谁都会走 提交于 2021-02-11 14:32:05
问题 I need to verify the signed data. I dont know how to use the public key. public bool VerifyData(string data, string signature) { //decode signature from base 64 byte[] signatureByte = System.Convert.FromBase64String(signature); //hash data to sha256 string hashedData = ConvertToSHA256(data); byte[] hashedDataByte = System.Convert.FromBase64String(hashedData); //verify with RSA PSS string absPath = System.Web.Hosting.HostingEnvironment.MapPath("~/App_Data/TP/public"); string publicKeyString =

C# RSA Import Public Key

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-11 14:28:02
问题 I need to verify the signed data. I dont know how to use the public key. public bool VerifyData(string data, string signature) { //decode signature from base 64 byte[] signatureByte = System.Convert.FromBase64String(signature); //hash data to sha256 string hashedData = ConvertToSHA256(data); byte[] hashedDataByte = System.Convert.FromBase64String(hashedData); //verify with RSA PSS string absPath = System.Web.Hosting.HostingEnvironment.MapPath("~/App_Data/TP/public"); string publicKeyString =

openssl der files importing into java keystore

本秂侑毒 提交于 2021-02-08 10:09:54
问题 I created a keypair with openssl and want them to import into the java-keystore: 1) openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out my_privatekey.pem 2) openssl rsa -pubout -outform DER -in my_privatekey.pem -out mypublic_key.der 3) openssl pkcs8 -topk8 -nocrypt -outform DER -in my_privatekey.pem -out my_privatekey.der First, I create a private-key (in .pem-Format), then I create a public key and at the end I convert the private key into a format that can be used in java

Diffie-Hellman Key Exchange with Javascript sometimes wrong

落爺英雄遲暮 提交于 2021-02-07 09:13:53
问题 After watching this video http://youtu.be/3QnD2c4Xovk I've been trying to follow it step by step, and haven't been able to produce the same results. Notably, when I try to do Math.pow(3, 54)%17, I get 7. While the speaker gets 15. I wrote a method that is supposed to simulate Diffie Hellman's key exchange using exactly what I found on http://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange This is my code: function diffieHellman(generator, prime, alice_secret, bob_secret){ var alice

I have a RSA public key exponent and modulus. How can I encrypt a string using Python?

泪湿孤枕 提交于 2021-02-07 06:32:50
问题 Given a public key exponent and modulus like the following, how can I encrypt a string and send it to a server as text? publicKey: 10001, modulus: 'd0eeaf178015d0418170055351711be1e4ed1dbab956603ac04a6e7a0dca1179cf33f90294782e9db4dc24a2b1d1f2717c357f32373fb3d9fd7dce91c40b6602' I am trying to replicate the functionality provided by the javascript rsa library http://www.ohdave.com/rsa/ in python. In javascript, it looks something like this: setMaxDigits(67); //sets a max digits for bigInt var

I have a RSA public key exponent and modulus. How can I encrypt a string using Python?

假装没事ソ 提交于 2021-02-07 06:32:36
问题 Given a public key exponent and modulus like the following, how can I encrypt a string and send it to a server as text? publicKey: 10001, modulus: 'd0eeaf178015d0418170055351711be1e4ed1dbab956603ac04a6e7a0dca1179cf33f90294782e9db4dc24a2b1d1f2717c357f32373fb3d9fd7dce91c40b6602' I am trying to replicate the functionality provided by the javascript rsa library http://www.ohdave.com/rsa/ in python. In javascript, it looks something like this: setMaxDigits(67); //sets a max digits for bigInt var

Validate JWT signature with RS512 using System.IdentityModel.Tokens.Jwt

ⅰ亾dé卋堺 提交于 2021-02-04 21:10:54
问题 I wanted to verify JWT signature with RS512 algorithm using public key. I fond the exact solution given in the below link and it is working perfectly. Verifying JWT signed with the RS256 algorithm using public key in C# But I want to use System.IdentityModel.Tokens.Jwt with my application. Can anyone change below working example by implementing System.IdentityModel.Tokens.Jwt ? static void Main(string[] args) { var token = "eyJhbGciOiJSUzUxMiIsImtpZCI6ImsxMDY5NDgxOTAifQ

Validate JWT signature with RS512 using System.IdentityModel.Tokens.Jwt

女生的网名这么多〃 提交于 2021-02-04 21:10:34
问题 I wanted to verify JWT signature with RS512 algorithm using public key. I fond the exact solution given in the below link and it is working perfectly. Verifying JWT signed with the RS256 algorithm using public key in C# But I want to use System.IdentityModel.Tokens.Jwt with my application. Can anyone change below working example by implementing System.IdentityModel.Tokens.Jwt ? static void Main(string[] args) { var token = "eyJhbGciOiJSUzUxMiIsImtpZCI6ImsxMDY5NDgxOTAifQ

Validate JWT signature with RS512 using System.IdentityModel.Tokens.Jwt

醉酒当歌 提交于 2021-02-04 21:10:03
问题 I wanted to verify JWT signature with RS512 algorithm using public key. I fond the exact solution given in the below link and it is working perfectly. Verifying JWT signed with the RS256 algorithm using public key in C# But I want to use System.IdentityModel.Tokens.Jwt with my application. Can anyone change below working example by implementing System.IdentityModel.Tokens.Jwt ? static void Main(string[] args) { var token = "eyJhbGciOiJSUzUxMiIsImtpZCI6ImsxMDY5NDgxOTAifQ