public-key-encryption

I understand the mathematics of RSA encryption: How are the files in ~/.ssh related to the theory?

醉酒当歌 提交于 2019-12-18 06:21:33
问题 I went through the math in the "worked example" in the RSA wiki page: https://en.wikipedia.org/wiki/RSA_(algorithm) and understood it entirely. For the remainder of this question, I will use math variables consistent with the wiki page. I'm on a Unix machine and I'm looking in the ~/.ssh directory and I see all these files id_rsa id_rsa.pub and I want to connect the theory with the practice. What exactly is in id_rsa? If I cat it cat id_rsa I get a big jumble of characters. Is this some

How to consume third party https wsdl web service in c#

可紊 提交于 2019-12-18 03:48:18
问题 In SoapUI tool I've configured .Jks file with Outgoing WS-Security Configurations Signature is BinarySecurityToken and algorithm is CanonicalizationMethod and SignatureMethod it is working perfectly. Now I try to consume from C# code as below : SprintApiService.QueryCsaPortTypeClient client = new QueryCsaPortTypeClient(); ClientCredentials ce = new ClientCredentials(); string fileName = Server.MapPath(""); fileName = fileName + "/test-01.pfx"; ce.ClientCertificate.Certificate = new

Convert PHP RSA PublicKey into Android PublicKey

好久不见. 提交于 2019-12-18 03:44:47
问题 I am working on a client server based application. Where I get PublicKey in this format as I saved it into String. Now I want to use this key in my Android(Java code), how can I use this ? 回答1: First you need to generate the public key from the pem format you provided, here is my method for doing this: /** * * @param PEMString -A file/string in .pem format with a generated RSA key (with "des3", using "openssl genrsa".) * @param isFilePath - If it's a file path or a string * @return java

Convert PHP RSA PublicKey into Android PublicKey

杀马特。学长 韩版系。学妹 提交于 2019-12-18 03:44:21
问题 I am working on a client server based application. Where I get PublicKey in this format as I saved it into String. Now I want to use this key in my Android(Java code), how can I use this ? 回答1: First you need to generate the public key from the pem format you provided, here is my method for doing this: /** * * @param PEMString -A file/string in .pem format with a generated RSA key (with "des3", using "openssl genrsa".) * @param isFilePath - If it's a file path or a string * @return java

C# How to simply encrypt a text file with a PGP Public Key?

自作多情 提交于 2019-12-17 17:56:26
问题 I've researched a bit about how to achieve what I said in the question and found several APIs but most of them look very complicated and since I'm just a noobie in this area I just want a simple method like: public String Encrypt(String message, PublicKey publicKey) Don't know if this can be done? If not then please someone enlighten me another way to achieve this :) Thank you. UPDATE: So far I have only seen that all of the library for OpenPGP encryption require both the public key and

How do I obtain the public key from an ECDSA private key in OpenSSL?

霸气de小男生 提交于 2019-12-17 16:25:15
问题 I am providing this sample application to show my problem #include <stdio.h> #include <stdlib.h> #include <openssl/ec.h> #include <openssl/bn.h> int main() { EC_KEY *pkey = NULL; EC_POINT *pub_key = NULL; const EC_GROUP *group = NULL; BIGNUM start; BIGNUM *res; BN_CTX *ctx; BN_init(&start); ctx = BN_CTX_new(); res = &start; BN_hex2bn(&res,"3D79F601620A6D05DB7FED883AB8BCD08A9101B166BC60166869DA5FC08D936E"); pkey = EC_KEY_new_by_curve_name(NID_secp256k1); group = EC_KEY_get0_group(pkey); pub

Using Base64 encoded Public Key to verify RSA signature

▼魔方 西西 提交于 2019-12-17 16:17:46
问题 In a nutshell, this is my problem: private string publicKeyString = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDVGUzbydMZS+fnkGTsUkDKEyFOGwghR234d5GjPnMIC0RFtXtw2tdcNM8I9Qk+h6fnPHiA7r27iHBfdxTP3oegQJWpbY2RMwSmOs02eQqpKx4QtIjWqkKk2Gmck5cll9GCoI8AUAA5e0D02T0ZgINDmo5yGPhGAAmqYrm8YiupwQIDAQAB"; /* Some transformation required, using publicKeyString to initiate a new RSACryptoServiceProvider object */ //for now: RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(); byte[] selfComputedHash =

Can I get the modulus or exponent from a SecKeyRef object in Swift?

拈花ヽ惹草 提交于 2019-12-17 16:15:26
问题 In Swift, I created a SecKeyRef object by calling SecTrustCopyPublicKey on some raw X509 certificate data. This is what this SecKeyRef object looks like. Optional(<SecKeyRef algorithm id: 1, key type: RSAPublicKey, version: 3, block size: 2048 bits, exponent: {hex: 10001, decimal: 65537}, modulus: <omitted a bunch of hex data>, addr: 0xsomeaddresshere>) Basically, this SecKeyRef object holds a whole bunch of information about the public key, but there seems to be no way to actually convert

RSA Encryption: Difference between Java and Android

﹥>﹥吖頭↗ 提交于 2019-12-17 15:24:15
问题 I am using RSA to encrypt username and password on Android and decrypt them on server (tomcat 6, java 1.6). Android Encryption: PublicKey pubKey = readPublicKeyFromFile(mod, ex); Cipher cipher = Cipher.getInstance("RSA"); cipher.init(Cipher.ENCRYPT_MODE, pubKey); byte[] cipherData = cipher.doFinal(data); return cipherData; Java Tomcat Decryption: PrivateKey pubKey = readPrivateKeyFromFile(mod, ex); Cipher cipher = Cipher.getInstance("RSA"); cipher.init(Cipher.DECRYPT_MODE, pubKey); byte[]

How to generate ssh compatible id_rsa(.pub) from Java

本小妞迷上赌 提交于 2019-12-17 10:23:36
问题 I'm looking for a way to programmatically create ssh compatible id_rsa and id_rsa.pub files in Java. I got as far as creating the KeyPair: KeyPairGenerator generator; generator = KeyPairGenerator.getInstance("RSA"); // or: generator = KeyPairGenerator.getInstance("DSA"); generator.initialize(2048); keyPair = generator.genKeyPair(); I can't figure out however how to create the String representation of the PrivateKey and PublicKey in the KeyPair. 回答1: The key format used by ssh is defined in