I've been reading about WhatsApp getting "end-to-end" encryption, and when reading about it, I've notice something.  If I want to send a message from cell $A$ to cell $B$, since there's a public key, I will pass my message through this "algorithm" and send to the cell $B$.  My question is, knowing the public key doesn't automatically gives you power to reverse engineer the message sent? How is that possible that knowing the algorithm that created a code and the code itself doesn't get you the original information?
46859
I've always been interested in encryption but I have never found a good explanation (beginners explanation) of how encryption with public key and decryption with private key works.  How does it encrypt something with one key and decipher it with another key?
45596
What is the currently industry-standard algorithm used to generate large prime numbers to be used in RSA encryption?  I'm aware that I can find any number of articles on the Internet that explain how the RSA algorithm works to encrypt and decrypt messages, but I can't seem to find any article that explains the algorithm used to generate the p and q large and distinct prime numbers that are used in that algorithm.
81006
It seems that OTP encryption is unbreakable. I have read some articles (Wikipedia, Blogpost, etc.), but I could not find any information about how they are used.  If I wanted to create a messenger service, how would I distribute the OTP keys? Both the sender and the receiver need this key before the message is sent, right?   And how do I make sure no one else gets these keys?
42455
Is it possible to encrypt a message using PGP so that multiple recipients (each with their own public private keypair) can decrypt it? I'd like to email one message which can be decrypted by each person with their own keys.
30477
I was curious what's to happen when $p = q$ for $N=pq$ in RSA scheme.  First I realize that one can easily find out $p$ and $q$ by taking a square root of $n$.  However, it appears to me that under $\pmod{N}$ where $p = q$, one cannot reliably retrieve the original message via $m^d$ where $m$ denotes an encrypted message and $d$ denotes the decryption key. Can someone explain why?  Thank you.
11164
Is it possible to find the key if we know the plaintext and ciphertext with RC4. How should I write the algorithm?
110421
I am new to crypto and trying to understand if it would be insecure to use a cipher such as AES to encrypt a key with the same key. If it is insecure, then why would it be insecure?  Basically, something like this:  encrypt(key, key)   What happens when both key and message are the same (128 bits)?  The obvious question would be why would I want to do that. If I have a secure channel to send the key, why encrypt it? My question is more for understanding.
31547
I was given a cryptography question during an interview the other day.   Imagine you are given an efficient algorithm which for a given RSA public key (n,e) is able to decrypt 1% of the messages encrypted with that key.   1% means that the algorithm will deterministically decrypt 1% of all possible ciphertexts on the first call, and will never decrypt the other 99% of all possible ciphertexts with any number of invocations.   Figure out an algorithm that uses this one and can decrypt any message. Any ideas?
81834
Suppose Alice chooses a random Prime $p$ and a random private Key $a \in \mathbb{Z}^*_p$. By accident, she also chooses a random number $g \in \mathbb{Z}^*_p$, which is not a generator of $\mathbb{Z}^*_p$ and therefore  $$\langle g\rangle \subset \mathbb{Z}^*_p$$  as opposed to $\langle g\rangle = \mathbb{Z}^*_p$, which would yield a valid key. Alice then computes $A \equiv g^a \pmod{p} $ and publishes the Tuple $(p,g,A)$ as her public key.  Bob now encrypts a message $M$ using Alices public key by computing  $$C_1 = g^b \pmod{p}$$ $$C_2 = M \cdot A^b \pmod{p}$$  Is it possible for an attacker (Eve) to distinguish a “real” ciphertext $(C_1,C_2)$ from a random ciphertext $(Z_1,Z_2) \stackrel{$}{\longleftarrow} \mathbb{Z}^*_p$ with significant advantage (say $Adv \geq \frac12$)?    Edit: I guess it should be enough to show, that the ciphertext cannot be random, if  $$\langle g \rangle \neq \langle C_1 \rangle \quad(\text{or $Z_1$, respectively})$$  But how can Eve check for this property efficiently? Can someone point me in the right direction here?    Edit: A real-world situation where this flaw occurred
18835
From what I heard, many encryption algorithms are based on the assumption that some problems are computationally hard, i.e, NP-complete. In the unlikely event that someone proves that P=NP, these codes will break.  Is there a practical encryption algorithm that will remain safe even if P=NP? I.e, an algorithm that depends on problems that are more difficult than just NP-complete?  My guess is that the answer is no: to be practical, a code must be verified in polynomial time, i.e, the problem must be in NP. Is this correct?
28378
From what I understand, based on the article , the public key is generated by performing $n$ tangent plus mirroring operations from the point $G$ over the elliptic curve, where $G$ is defined in  and $n$ is a natural number that directly relates to the private key.   As I know the public key and the seed value $G$, I could start a process computing $$G + G, G + G + G, \dots$$ and comparing those results with the public key value until it matches.   If your answer would be that this process is very slow: if this process is slow, the same applies to computing the public key from the private key (because the operations are the same except for the check operation). So, how it is possible to compute the public key in a very fast way?
46470
I quote Bobby's question here since I encountered the same one...    Consider the following protocol for two parties to flip a fair coin.   Trusted party $T$ publishes her public key $K_{pub}$ $A$ chooses a random bit $b_A$, encrypts it under $K_{pub}$, and announces the ciphertext $c_A$ to $B$ and $T$ $B$ does the same and announces a ciphertext $c_B$ (where $c_B \neq c_A$) $T$ decrypts $c_A$ and $c_B$, and announces the results. Both parties $XOR$ the results to obtain the random value $b_A\oplus b_B$.   It was shown that  was not appropriate for the encryption scheme.  seems to fail to work also. Since $c_A=m^e \mod N$. Then if $m=1$, $c=1$. If $B$ receives $A$'s cipher he will know the exact value of $m$.   So what should the appropriate encryption scheme be?
35366
When a program is decrypting a message encrypted by CBC mode, what does it find out, whether the last bytes of the last block is part of the padding or part of the plaintext?  Example: Use CBC mode with 4 Byte blocksize and encrypt the following two messages:  m1 = ABCDEF m2 = ABCDEF22   M1 gets padding and will be "ABCDEF22". How do I find out, whether the original plaintext was ABCDEF, or ABCDEF22?
15506
It's been over 30 years since Rivest, Shamir and Adleman first  described their algorithm for public-key cryptography; and the intelligence community is thought to have known about it for around 40 years&mdash;possibly longer.  It's fair to assume that, during those 40 years, certain three-letter organisations have employed their vast resources toward "breaking" RSA.  One brute-force approach may have been to enumerate every possible key-pair such that, upon encountering a message known to be  encrypted with a particular public-key, they need merely lookup the associated private-key in order to decrypt that message.  Signatures could be forged similarly.  How reasonable is this hypothesis?  How much computing resource would have been required over those 40 years to enumerate every possible {1024,2048,4096}-bit key-pair?  I think it best to avoid discussion and leave the question of whether the spooks could have harnessed such resource as an exercise to the reader.
14644
I've recently heard some people claiming that if the fact that P = NP is proven, most (all?) the current cryptographic algorithm considered secure like RSA will be unusable in secure systems.  My question is :  1. If P = NP is proven TODAY, will a RSA key (let say 3072 bits) be still enough to ensure a certain amount of security.  2. If not, what could we do to have at least the same amount of security (take a larger key length? a stronger algorithm?)
61142
With regards to user authentication...   The server sends Alice a randomly chosen number. Alice signs the number and sends the signature back to the server. The server checks the signature using Alice's public key. If it's valid, the server accepts her connection request.   Suppose that Alice uses the same private key to log in to the server and sign her emails. The authentication mechanism signs the bare challenge without hashing, while Alice signs the hash of the email message.   Apparently, the server can forge emails from Alice under this scheme? If so, how could this be prevented?
1092
What mathematical fields of knowledge would be required in order to get a good understanding of encryption algorithms?   Is it basic algebra, or is there a "higher education" mathematical field dedicated to encryption? I know there is the cryptography field, but what is the subset of knowledge required for cryptographers?