FAQ Database Discussion Community


PGP with empty passphrase fails in Mule

encryption,mule,public-key-encryption,pgp
I'm trying to create an encryption-decryption service in Mule using PGP. As I created my key pair without a passphrase (since this is just a proof of concept), naturally I am not setting it in my config. However it seems Mule is enforcing a non-empty passphrase. The error I'm getting:...

CryptoAPI - how to extract RSA public key from private

rsa,public-key-encryption,cryptoapi,encryption-asymmetric
Using windows CryptoAPI, is it possible to get public RSA key from a private key which was imported (not generated)? If I use CryptGenKey, I can call CryptExportPublicKeyInfo and CryptImportPublicKeyInfo to obtain the public key handle. However, when I try to do the same thing with private key decoded from...

What is special for a private key to be PEM-formatted?

python,openssl,public-key-encryption,jwt
I am trying to use the Google API with a oAuth service account, with Python 3.4. One of the steps is to generate a JSON Web Token, for which I use PyJWT. My code for the generation is the following: # opening the certificate downloaded from the Google API console...

How would I load a Private / Public Key from a string / byte array or any other container

c++,cryptography,rsa,public-key-encryption,crypto++
Is it possible to store a RSA Private/Public Key in the source for example in a byte[] or string or any other container and use this key for encryption / decryption? A decode function from file would look like: void Decode(const string& filename, BufferedTransformation& bt) { // http://www.cryptopp.com/docs/ref/class_file_source.html FileSource file(filename.c_str(),...

Getting RSAPublicKey From File With Extension pem

java-ee,rsa,public-key-encryption,public-key,pem
I am trying to implement Paybox Payment Gateway integration to my application. After payment Paybox returns me a signature and I have to verify it. I have test keys provided by Paybox, 'TestK004.prv.pem' and 'TestK004.pub.pem'. Here is my Test Class: package com.alpha.shop.component.payment.methods.crc.impl.ww.paybox; import java.security.interfaces.RSAPublicKey; import java.security.Signature; import java.security.KeyFactory; import java.security.spec.X509EncodedKeySpec;...

How to convert from String to PublicKey?

java,encryption,cryptography,public-key-encryption
I've used the following code to convert the public and private key to a string KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance("RSA"); keyPairGen.initialize(2048); KeyPair keyPair = keyPairGen.genKeyPair(); PublicKey publicKey = keyPair.getPublic(); PrivateKey privateKey = keyPair.getPrivate(); String publicK = Base64.encodeBase64String(publicKey.getEncoded()); String privateK = Base64.encodeBase64String(privateKey.getEncoded()); Now I'm trying to convert it back to public ad...

Difference between Sha1WithRSA and Sha1WithRSAEncryption?

java,rsa,digital-signature,sha1,public-key-encryption
I've noticed these two algorithms that have different names, but functionally sound very similar. When I looked further, I've found out Sha1WithRSA is available across many Security Providers, but Sha1WithRSAEncryption is only available if I use the BouncyCastle Provider. Example: JcaContentSignerBuilder("SHA1WithRSAEncryption").setProvider("BC") Is it replacable with JcaContentSignerBuilder("SHA1WithRSA").setProvider("SunJSSE") ? Can someone throw...

Use previously generated private key in ECIES

c++,public-key-encryption,crypto++,elliptic-curve
I wan to encrypt /decrypt data using ECIES , I am using cryptopp for this. AutoSeededRandomPool prng; //get private key generated ECIES<ECP>::Decryptor d0(prng, ASN1::secp256r1()); PrintPrivateKey(d0.GetKey()); //get public key ECIES<ECP>::Encryptor e0(d0); PrintPublicKey(e0.GetKey()); //encrypt the message string em0; // encrypted message StringSource ss1 (message, true, new PK_EncryptorFilter(prng, e0, new StringSink(em0) ) );...

Signing and verifying with java android

java,android,rsa,digital-signature,public-key-encryption
I'm trying to sign an encrypted message with a private key and verify it in Java. This is my first time working with encryption and signatures so I'm not sure how it is supposed to work and I'm kind of stuck here. The verification always returns false. I am posting...

Dictionary based bruteforce on a RSA Private Key

security,ssl-certificate,public-key-encryption,dictionary-attack,john-the-ripper
I have an RSA Private key for my SSL certificate. Unfortunately I forgot the passphrase. Here is the header info: -----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: AES-256-CBC,9A3F1B0DB81DA3C64E5BCA3534544E04 I would like to perform a dictionary attack to try to crack it. Could anyone tell me how to do it? Maybe...

gpg decryption fails with no secret key error

unix,encryption,public-key-encryption,gnupg
I have a gpg .key file that is used as passphrase for decrypting a .dat.pgp file. The encrypted .data.pgp file gets successfully decrypted on one server with same .key file using following command cat xxx_gpg.key | /usr/bin/gpg --batch --quiet -o xxx.dat --passphrase-fd O -d xxx.dat.pgp But, when I move same...

Is Base64 an encryption or encoding algorithm?

encryption,encoding,base64,public-key-encryption
I have to use an encryption algorithm using Base64 but when I researched online I find forums state it is an encoding algorithm. This has me confused. :( Is Base64 an encryption or encoding algorithm? How do we differentiate between the two except for the fact that one is publicly...

What's wrong with this encryption code?

java,encryption,cryptography,public-key-encryption
I have the following code that generates an AES-128 one-time key. After that I encrypt this one-time key using an RSA public key read from a certificate. The encrypted bytes is always 0. Why? // Generate a one-time key KeyGenerator keyGenerator = KeyGenerator.getInstance("AES"); keyGenerator.init(128); SecretKey oneTimeKey = keyGenerator.generateKey(); System.out.println("Encrypted bytes...

Public encryption in crypto on node 0.12

node.js,encryption,public-key-encryption
I need to encrypt (and decrypt) a string with a public key previously generated in nodejs (i'm using version 0.12) with crypto module, but i'm unable to do it. For first i generated the keys in this way: var diffHell = crypto.createDiffieHellman(60); diffHell.generateKeys('base64'); var publicKey = diffHell.getPublicKey('base64'); //or whatever 'hex','binary'...

InvalidKeySpecException using public key

java,android,security,encryption,public-key-encryption
I'm desperately trying to encrypt a message using asymmetric public / private key cryptography on an Android. I'm on Windows and I've generated a public and private key using puttygen. I'm not sure what difference it makes but I've selected SSH-2 RSA. Here is the public key: AAAAB3NzaC1yc2EAAAABJQAAAQEAh63orUzl0UTd7jj0KNYJg1+kNnty0QHyJu0r Cajf5Kl7qWJaGXPfwsG8Qt3teafs5sv0JBSinab0s/5wfQmd1QPpXTMP93Wc4ucp 1VC/9B2o8XVi4fKoGTehB48yrSfI6KF2AIeASM1jUswydKxsuS4AS2mLGV/HuoKD...

Breaking RSA given we know minimal solution to discrete log mod N [closed]

math,rsa,public-key-encryption,modular-arithmetic
So I'm trying to figure out the connection between the discrete log problem and RSA. I think this is what the following question is trying to do. Suppose you have an oracle which gives you the smallest positive x satisfying the following congruence: g^x ≡ k (mod N) where N...

Can encryption and Digital signatures produce exactly one file?

java,cryptography,public-key-encryption
I am trying to encrypt a file in Java using AES and then Digitally sign it and store it in a database, so that I can verify the signature and then decrypt it when I fetch that file. I have gone through Oracle's tutorial on digital signature but they create...

What does it mean to encrypt with a public key? [closed]

security,cryptography,public-key-encryption
I've heard lots of public key theory, but I've never really understood how you can encrypt something that can be decrypted with a private key that you don't have. How does encrypting a message with a public key make it so that only the person with the corresponding private key...

How to share a public key for OAuth2 JWT validation?

validation,oauth-2.0,public-key-encryption,jwt
I am implementing an app that connects to an OAuth2 server and it gets back a Json Web Token (JWT). I am passing the token along and I want to independently validate that the token came from the issuing source. I can do this, no problem, with the public key...

Computing private key of a user from his RSA public key

security,encryption,cryptography,rsa,public-key-encryption
I know that we will give (N,e) as our public key to every one and N is product of two prime numbers P and Q. But I know that product of two prime numbers has only 4 divisors (1, itself, P, Q) and using a simple while loop hackers can...

Can I implement TLS by skipping some steps?

ssl,https,public-key-encryption
Is it possible to have a cut down implementation of TLS , where we just presume the server we are connecting to is trusted - after the server sends its certificate, can we bypass verification of this and do away with any further processing , and get right into standard...