public-key

How to load the RSA public key from file in C#

雨燕双飞 提交于 2019-12-27 11:05:07
问题 I need to load the following RSA public key from a file for use with the RSACryptoServiceProvider class. How can I do this? -----BEGIN PUBLIC KEY----- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/syEKqEkMtQL0+d XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX+izR KbGMRtur2TYklnyVkjeeHfAggo8vWQmWesnOG55vQYHbOOFoJbk0EkwEr5R/PbKm byXPPN8zwnS5/XXXXXXXXXXXX -----END PUBLIC KEY----- This code works with my pub key: http://www.jensign.com/opensslkey/ Here is the code I am using

how to use RSA public key decrypt cipher in iOS [closed]

冷暖自知 提交于 2019-12-25 06:15:43
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . I got a problem like title indicates. In the app,first I generate a random number and post it to server.Server uses its own RSA private key to encrypt the random number and return the encrypt number back to me.I have the server's RSA public key kept in my local as Base64 string

how to use RSA public key decrypt cipher in iOS [closed]

北战南征 提交于 2019-12-25 06:15:15
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . I got a problem like title indicates. In the app,first I generate a random number and post it to server.Server uses its own RSA private key to encrypt the random number and return the encrypt number back to me.I have the server's RSA public key kept in my local as Base64 string

Veryfing fingerprints using SharpSSH while connecting to SFTP Server

自古美人都是妖i 提交于 2019-12-25 03:14:32
问题 I am using Tamir.SharpSSH to make SFTP connections in my .NET code. I have servers' host, port, username, password and servers' fingerprint. I am able to connect to the server without the fingerprint. Is there any way to match the fingerprint that I have with the servers' before making the connection? Following is my C# code for the connection: string _ftpURL = "ftp.com"; //Host URL or address of the SFTP server string _UserName = "Login_Id"; //User Name of the SFTP server string _Password =

Qt: data decryption using private/public key

走远了吗. 提交于 2019-12-24 08:39:39
问题 I want to decrypt data which has been encrypted using a private key. I can load the public key for decryption as follows: QFile file(":/sample.crt"); file.open(QIODevice::ReadOnly); const QByteArray bytes = file.readAll(); file.close(); QSslCertificate ssl(bytes, QSsl::Pem); //Key: ssl.publicKey(); But how can I use the key do decrypt the data? I know that there are 3rd party libraries like QCA (http://delta.affinix.com/qca/) but is it possible to do this with the built-in Qt functions?

Do I need to seed any random number generator before using EVP_PKEY_keygen of OpenSSL?

隐身守侯 提交于 2019-12-24 04:35:10
问题 On the OpenSSL Wiki page called EVP Key and Parameter Generation it states the following: Since these functions use random numbers you should ensure that the random number generator is appropriately seeded But nowhere on EVP_PKEY_keygen does it make mention of seeding a random number generator. It only discusses the low-level doc pages for non-EVP functions for generating keys. I have also searched and everywhere no mention is made of seeding when the EVP functions are used. So my question is

convert PEM encoded RSA public key to AsymmetricKeyParameter

丶灬走出姿态 提交于 2019-12-24 00:50:25
问题 I am trying o create a method that constructs an AsymmetricKeyParameter from a PEM encoded public key. Unfortunately, pemReader.ReadObject() return null. Here's a working solution for a private key: convert PEM encoded RSA private key to AsymmetricKeyParameter What is wrong with this method? static AsymmetricKeyParameter ReadPublicKeyFromPemEncodedString(string pemEncodedKey) { AsymmetricKeyParameter result = null; using (var stringReader = new StringReader(pemEncodedKey)) { var pemReader =

Unable to load RSA public key

佐手、 提交于 2019-12-23 12:26:57
问题 I'm trying to read RSA public key shown below, but I get an exception at line 6: java.security.spec.InvalidKeySpecException: java.security.InvalidKeyException: IOException: algid parse error, not a sequence My code: String rsaPublicKey = rsaPublicKeyString.replace( "-----BEGIN RSA PUBLIC KEY-----\n", ""); rsaPublicKey = rsaPublicKey.replace("\n-----END RSA PUBLIC KEY-----", ""); byte[] bytes = EncryptionUtils.decodeBase64(rsaPublicKey); KeyFactory keyFactory = KeyFactory.getInstance("RSA");

Private and public key separately

倖福魔咒の 提交于 2019-12-23 02:36:26
问题 οκ!I want to establish a client server communication oves SSL/TLS in java. The server is multithreaded. With openssl I acted as my own CA (created private key and self-signed certificate for the authority). Now I want to create keys and certs for my server and clients which are signed from the CA I created. 1)Do I have to create certs and keys from the prompt for every single client? Or is it another "automated" way eg with a script? 2) I have seen that this code for setting up keystores

RSA public key created in iOS/Swift and exported as base64 not recognized in Java

纵饮孤独 提交于 2019-12-22 05:33:51
问题 TL;DR: RSA public key generated in iOS and stored in the keychain, exported as base64 and sent to a java backend, is not recognized. I'm implementing a chat encryption feature in an iOS app, and I'm using symmetric + asymmetric keys to handle it. Without going too much into details, at backend I use the user's public key to encrypt a symmetric key used to encrypt and decrypt messages. I created two frameworks, respectively in Swift and in Java (backend) to handle key generation, encryption,