public-key-encryption

Security from evil User

最后都变了- 提交于 2019-12-13 22:16:34
问题 My X system uses public key to decrypt a cipher and do some work based on that. But user of the system whom i do not trust has access to the system, cipher and the key. So what he can do is change the cipher, create another set of keys encrypt using private key and replace the cipher and public key both. So next time system will not know that message has change. I basically do not care if user can read it, my problem is he can not change it, so i thought of a MAC unfortunately that evil user

RSA Encryption File larger than PublicKey

笑着哭i 提交于 2019-12-13 22:14:37
问题 With the following method i can successfully encrypt a NSData-Object which is not bigger than the 256Bit: OSStatus SecCertificateCopyPublicKey ( SecCertificateRef certificate, SecKeyRef *key ); - (NSData *)encryptWithData:(NSData *)content { OSStatus result = -1; NSData *plainTextData = content;//[@"123456789" dataUsingEncoding:NSUTF8StringEncoding]; size_t plainTextLength = [plainTextData length]; SecTrustRef trustRef; SecTrustResultType trustResult; SecPolicyRef policy =

BouncyCastle J2ME RSA using custom keys

梦想的初衷 提交于 2019-12-13 12:42:34
问题 I would like to use BouncyCastle J2ME/RIM Crypto in my Blackberry Application. The issue i'm having is that I would like to generate the public key for encryption from a C#.NET program that sends the key to the BlackBerry. Is it possible to encrypt a message using a raw string? Also, do I need to know other common variable such as modulo etc? Apologies but i'm completely new to cryptography algorithms. Do I need BouncyCastle for this or can the above be done with RIM Crypto? Thanks, Conor 回答1

Extract public key from private key in C#

心已入冬 提交于 2019-12-13 10:14:50
问题 I used sn.exe to generate a key pair (private and public key). I extract a public key from private key as follows: sn -p keyPair.snk publicKey.snk I read it by using C# and store it in database as binary to use for encrypting my data. Is there any way to extract a public key from a private key in C# without using sn.exe ? NOTE : I want a public key as a byte to compare it with the one I store in my database. 回答1: Is there any way to extract a public key from a private key in C# without using

How to get the public key? [closed]

可紊 提交于 2019-12-13 10:09:54
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I'm trying to get the public key from the following but I'm unable to retrieve. -----BEGIN CERTIFICATE----- MIIDfDCCAmSgAwIBAgIECmnOfzANBgkqhkiG9w0BAQUFADB2MQswCQYDVQQGEwJJ TjESMBAGA1UECBMJS0FSTkFUQUtBMRIwEAYDVQQHEwlCYW5nYWxvcmUxDjAMBgNV BAoTBVVJREFJMRQwEgYDVQQLEwtUZWNoIENlbnRlcjEZMBcGA1UEAxMQQXV0aCBU

What is the key agreement (or key derivation) function used by openssl?

只谈情不闲聊 提交于 2019-12-13 09:48:41
问题 I am trying to replace a openssl code to CNG winapi code. Below is the barebone openssl code which i have. const char *generator = ""; // 256 character hex string const char *prime = ""; // 256 character hex string dh = DH_new(); // Initialize dh's generator and prime BN_hex2bn(&(dh->g), generator); BN_hex2bn(&(dh->p), prime); // Generate public and private keys DH_generate_key(dh); // Extract server's public key from init_msg's 'key' BIGNUM *server_pub_key = BN_new(); BN_hex2bn(&server_pub

Source of PEM files for web service access

故事扮演 提交于 2019-12-13 04:33:37
问题 I should have paid more attention to my classes that covered security. I'm quite confused about something. To start, here's the background of what I'm trying to accomplish. I have a web service that I need to access. The web service is set up as HTTPS. The traffic between client and server is encrypted (this doesn't have to do with authentication). I'm interacting with the web service via cURL and PHP. I've gotten an example to work locally over HTTP and I'm fairly confident I'm on the right

How to generate and use public key cryptography in WinCrypt

拥有回忆 提交于 2019-12-12 16:14:15
问题 I'm currently experimenting with the Windows Cryptography API and running into some problems with Public-Key-Cryptography. I can find lots of examples of how to encrypt items, but nothing directly addressing a start-to-finish public key model. Here's a rough outline of how my current code looks to generate an encryption key pair, I've removed the error checking code for readability // MAKE AN RSA PUBLIC/PRIVATE KEY: CryptGenKey(hProv, CALG_RSA_KEYX, CRYPT_EXPORTABLE, &hKey); // NOW LET'S

How to get RSACryptoServiceProvider public and private key only in c#

断了今生、忘了曾经 提交于 2019-12-12 14:11:07
问题 I am running below code to get public and private key only, but it seems it outputs the whole XML format. I only need to output the keys as shown in Public and Private Key demo static RSACryptoServiceProvider rsa; private RSAParameters _privateKey; private RSAParameters _publicKey; public RSACrypto() { rsa = new RSACryptoServiceProvider(2048); _privateKey = rsa.ExportParameters(true); _publicKey = rsa.ExportParameters(false); } public string GetPublicKeyString() { var sw = new StringWriter();