Use the BigInteger(String val) constructor to create the number, that is: pass the number as a String. The BigInteger class implements an arbitrary-precision integer data type, any integer can fit - as long as there's enough physical memory to represent it: BigInteger p = new...

security,encryption,cryptography,diffie-hellman

No You can't, to compute the secret key you must first be able to compute a (Alice's secret key) or b (Bob's secret key) this will require the eavesdropper to compute the "discrete logarithm " and since there isn't any known efficient algorithm that can calculate that than Diffie_Hellman is...

php,encryption,https,elliptic-curve,diffie-hellman

client during the request creates a master key, which is then encrypted using server's public key and sent to server. This master key (as a plain text) is then used as a symmetric key for encrypting ongoing communication. Is this correct? Well, all-in-all, No. Because you are asking about...

security,ssl,diffie-hellman,public-key-exchange

In practice, does this mean I never need a certificate? Or that means I need a new cert every single time? It means that the generation of the key is independent of the certificate. You could use DH without certificate (anonymous DH), but than the connection would be open...

performance,cryptography,biginteger,diffie-hellman,modular-arithmetic

64 bit CPUs are significantly faster at big integer arithmetic than 32 bit CPUs. My experience is a factor 2 with identical code and a factor 4 with specialized code. In code written with x86 in mind many intermediate values have 64 bits. For example if you multiply two 32...

java,cryptography,rsa,diffie-hellman

The mathematics behind Diffie-Hellman and RSA are different enough so that an RSA key can't work for DH. Diffie-Hellman DH is a key-exchange, it produces a shared key given two key-pairs. It doesn't encrypt data directly. (But it's easy to build encryption by combining DH with symmetric encryption). Both sides...

bouncycastle,javacard,elliptic-curve,diffie-hellman

There is a problem in your implementation of KeyAgreement.ALG_EC_SVDP_DH in the terminal side. The correct length of output of the this method of key agreement should always be 20 bytes since SHA-1 is being performed on the derived output. So in your terminal side, you should perform SHA-1 after generating...

ssl,diffie-hellman,man-in-the-middle

High level view: At the end of the handshake a signature is done covering the whole handshake. This signature implicitly includes that only the server knows the private key of the certificate. Thus the signature can not be faked by a man-in-the-middle as long as the certificate was properly validated...