instruction
stringlengths
15
30k
In RSA Algorithm, we choose p and q as the prime numbers. And we select a value e which is co-prime to phi. Then we calculate the value of d. My question is what could be the MAXIMUM value of d? is there an upper limit to it?
I want to design a scheme to encrypt a variable-length message with a secret key, to provide confidentiality. The message is a short human-readable text string with byte granularity, let's say under 300 bytes. I prefer that the ciphertext is the same length as the plaintext (avoid padding). Along the way, I also wan...
In the RSA algorithm, we choose $p$ and $q$ as prime numbers and we select a value $e$ which is coprime to $\varphi(pq)=(p-1)(q-1)$. Then we calculate $d:=e^{-1}\bmod\varphi(pq)$. My question is: What could be the **maximum** value of $d$? Is there an upper bound to it?
Is there an upper bound to the private exponent in RSA?
Am trying to understand Garbled Circuit based approach for Secure Two party Computation. There isn't much leakage in the [classic millionaire's][1] problem where the comparison circuit is used. But imagine they want to do some arithmetic operation (like addition or multiplication) without revealing their individual...
As I understand it, AES in CBC mode does an XOR of the 128-bit input vector and the first 128 bits of plain text. Is this correct? I am using the PHP 5.3 openssl extension in aes-256-cbc mode. I'm experimenting with a round trip, that is, encrypting and then decrypting to make sure I get back the original string. ...
Precisely how does AES use the input vector?
At the moment I'm designing a crytosystem for a VPN server. One of the requirements is Perfect Forward Secrecy, but I'n not sure how to implement authentication on the ephemeral key exchange. If both parties possess a signed public key (signed by a CA or common trusted party) and exchange this, they can verify the i...
As I understand it, AES in CBC mode does an XOR of the 128-bit initialization vector and the first 128 bits of plain text. Is this correct? I am using the PHP 5.3 openssl extension in aes-256-cbc mode. I'm experimenting with a round trip, that is, encrypting and then decrypting to make sure I get back the original s...
Precisely how does AES (or any CBC mode) use the initialization vector?
I am not thinking only steganography in images, I think it is also possible to encode data for example into the length of spaces of a clear html text. I suspect, the steganography changes (elevates) the entropy of the non-significant part of the messages. But: 1. How to detect in the general case, what is "non...
Detecting steganography by analysing non-significant data enthropy?
As I understand it, AES in CBC mode does an XOR of the 128-bit initialization vector and the first 128 bits of plain text. Is this correct? I am using the PHP 5.3 openssl extension in aes-256-cbc mode. I'm experimenting with a round trip, that is, encrypting and then decrypting to make sure I get back the original s...
Precisely how does CBC mode use the initialization vector?
I am not thinking only steganography in images, I think it is also possible to encode data for example into the length of spaces of a clear html text. I suspect, the steganography changes (elevates) the entropy of the non-significant part of the messages. But: 1. How to detect in the general case, what is "non...
Detecting steganography by analysing non-significant data entropy?
> Since these keys are not signed, how can one authenticate the other to guarantee that the keys were not altered/switched? They have to *be* signed. By the key-exchanging parties, using their long term keys. > Even if the keys are exchanged over an verified channel (for example using the signed and trusted publi...
I do research with people about their illegal drug use, and for one project I'm doing surveys with them when they visit a needle exchange. So over time the same people get repeatedly surveyed as they visit the exchange many times over. In order to link together multiple surveys from the same person across time (bec...
Hiding identifying data while allowing matching?
I am considering a "secure function evaluation" problem: Consider two parties: A and B. A has a one-to-one mapping function $f(x)=k$. Basically, the function $f(x)$ can be regarded as a table of two columns. The first column is the domain of $x$ denoted as $D$. The second column is the range $K$. The party B has a...
A secure function evaluation problem and an alternative of 1 out of n oblivious transfer?
The past week I've been looking into - and playing with - algorithms for factoring RSA moduli. From what I understand, it's important that the primes p and q are of the same magnitude as the square root of N, but they shouldn’t be too close. To find out how close numbers in the real world are to sqrt(N), I've used O...
The past week I've been looking into - and playing with - algorithms for factoring RSA moduli. From what I understand, it's important that the primes p and q are of the same magnitude as the square root of N, but they shouldn’t be too close. To find out how close p and q are to sqrt(N) in the real world, I've used O...
The problem is known in the literature as *private function evaluation* (PFE). A sender has input (a function) $f$; a receiver has input $x$, and only the receiver learns $f(x)$. * If you are willing to **leak the topology of a circuit that computes $f$** (but not the identity of the gates), then using classical gar...
The problem is known in the literature as *private function evaluation* (PFE). A sender has input (a function) $f$; a receiver has input $x$, and only the receiver learns $f(x)$. * If you are willing to **leak the topology of a circuit that computes $f$** (but not the identity of the gates), then using classical gar...
The past week I've been looking into - and playing with - algorithms for factoring RSA moduli. From what I understand, it's important that the primes p and q are of the same magnitude as the square root of N, but they shouldn’t be too close. To find out how close p and q are to sqrt(N) in the real world, I've used O...
I am writing an app that needs to split a stream of plaintext bytes into variable-sized chunks (for deduplication). The way this is traditionally done is using a rolling hash function defined over some window `w` (e.g. 48 bytes). This window "slides" along the byte stream and is evaluated at each byte position, and whe...
Hash functions are often used in cryptographic schemes and protocols, and that doesn't necessarily mean that their proofs are on the Random Oracle model. That leads to the following question: What is the "turning point" in which the use of a hash function requires a proof on the Random Oracle model? - Is it when th...
When is the Random Oracle model (not) necessary?
i am looking for CMS AuthEnvelopedData test vectors for AES-GCM mode. I havent seen any ready to use test vectors for it. There are test vectors for AES-GCM mode but not for its CMS support. Is there any open source cryptography library that is implemented AES-GCM with CMS support(AuthEnvelopedData Content Type). So...
I am looking for *CMS AuthEnvelopedData* test vectors for AES-GCM mode. I haven’t seen any ready-to-use test vectors for it. There are test vectors for AES-GCM mode but not for its CMS support. I even checked open source cryptography libraries which implemented AES-GCM with CMS support (AuthEnvelopedData Content Typ...
Are there any test vectors for the CMS content type AuthEnvelopedData (for AES-GCM)?
I'm using XTEA to encrypt passwords that I store in a database. (I need to be able to decrypt these passwords later to log in on another system.) But now I have noticed something: if I decrypt a password using a different key I can still see some of the patterns in the plain text. I am not worried about an attack again...
I'm using XTEA to encrypt passwords that I store in a database. (I need to be able to decrypt these passwords later to log in on another system.) But now I have noticed something: if I decrypt a password using a different key I can still see some of the patterns in the plain text. I am not worried about an attack again...
**Question**: How to determine the RSA Private key size from the Public.key file? Just roughly, how big it could be? $ ls -la Public.key -rw-r--r--. 1 user user 498 Sep 4 15:31 Public.key $ The `Public.key` was generated using the Java API (which defaults to the X509 `SubjectPublicKeyInfo` struc...
I'm looking to implement Lamport signatures as a little fun project, and I need a _fast_ one way function that maps $\{0,1\}^{256} \rightarrow \{0,1\}^{256}$. I was wondering whether I could safely use the ChaCha core for that, by setting the input as the key, the nonce and counter to 0 and truncating the output to ...
I see in the [Salsa20 specification][1] there are test examples throughout the document to help an implementer make sure every function works as designed. Consequently the whole algorithm would work perfectly if all the tests pass. Without these test vectors it would be very difficult to know whether the code was worki...
I've written implementations of Salsa20 and ChaCha that accept 384 and 448 bit keys. It was fairly trivial to implement, the 'sigma' constant is replaced with key material, and the counter, (which was initialized at 0), rotates and can be initialized at any value. So along with the 64 bit vector, the entire 512 bit sta...
For example: p = 5, q = 11, n = 55 $\phi$(55) = 40 e = 3, $\phi$(55) and 3 are relatively prime m = 3, then: $3^3 mod(55) = 27$ m = 113, then: $113^3 mod(55) = 27$ I heard that e and $\phi$(n) have to be relatively prime in order for the encryption to give unique solutions, but it seems that even if t...
In the RSA encryption system, are there not multiple messages m that give the same cipher text c?
For example: p = 5, q = 11, n = 55 $\phi$(55) = 40 e = 3, $\phi$(55) and 3 are relatively prime m = 3, then: $3^3 mod(55) = 27$ m = 113, then: $113^3 mod(55) = 27$ I heard that e and $\phi$(n) have to be relatively prime in order for the encryption to give unique solutions, but it seems that even if t...
Conclusion from an audit (https://defuse.ca/audits/encfs.htm): > EncFS is probably safe as long as the adversary only gets one copy > of the ciphertext and nothing more. EncFS is not safe if the > adversary has the opportunity to see two or more snapshots of the > ciphertext at different times. I don't qui...
Is EncFS good for online storage services?
Conclusion from [an EncFS audit][1]: > EncFS is probably safe as long as the adversary only gets one copy > of the ciphertext and nothing more. EncFS is not safe if the > adversary has the opportunity to see two or more snapshots of the > ciphertext at different times. I don't quite understand this sentenc...
I want to know what the state of the art in the following cryptographic problem is. Assume a public channel on which encrypted messages are exchanged, using symmetric key encryption. I hold a couple of secret keys. For each ciphertext message on the shared channel, I need to determine if I can decrypt the ciphe...
I want to know what the state of the art in the following cryptographic problem is. Assume a public channel on which encrypted messages are exchanged, using symmetric key encryption. I hold a couple of secret keys. For each ciphertext message on the shared channel, I need to determine if I can decrypt the ciphe...
I'm reading Rafael Pass's lecture notes on one-way function and came across two definitions. The first one is: A function $f$ is one-way if $f$ can be computed in P.P.T. and there exists no non-uniform P.P.T. $A$ such that $\forall x \in \{0,1\}^*, Pr[A(f(x)) \in f^{-1}(f(x))]=1$ However this definition is con...
I'm reading Rafael Pass's lecture notes on one-way function and came across two definitions. - The first one is: A function $f$ is one-way if $f$ can be computed in P.P.T. and there exists no non-uniform P.P.T. $A$ such that $\forall x \in \{0,1\}^*, Pr[A(f(x)) \in f^{-1}(f(x))]=1$ However this definition ...
I assume that $|x|$ in the exercise denotes the length of the bitstring $x$. If so, the answer is simple: a [polynomial time](https://en.wikipedia.org/wiki/Time_complexity#Polynomial_time) algorithm needs to complete in a number of steps bounded by a polynomial function of *the length of* its input. How long is $...
I assume that $|x|$ in the exercise denotes the length of the bitstring $x$. If so, the answer is simple: a [polynomial time](https://en.wikipedia.org/wiki/Time_complexity#Polynomial_time) algorithm needs to complete in a number of steps bounded by a polynomial function of *the length of its input.* How long is $...
I've started implementing PBKDF2 algorithm recently and since I'm new in crypto, I would like to ask if my implementation is good. I looked up some documentations and I tried to follow many of them and now I am really confused. Here is my C/C++ code: typedef unsigned long UL; volatile class KDF2 { #d...
Is this proper PBKDF2 key derivation function algorithm?
I've started implementing PBKDF2 algorithm recently and since I'm new in crypto, I would like to ask if my implementation is good. I looked up some documentations and I tried to follow many of them and now I am really confused. Documentations I've followed: https://en.wikipedia.org/wiki/PBKDF2 https://en.wi...
Conclusion from [an EncFS audit][1]: > EncFS is probably safe as long as the adversary only gets one copy > of the ciphertext and nothing more. EncFS is not safe if the > adversary has the opportunity to see two or more snapshots of the > ciphertext at different times. I don't quite understand this sentenc...
Is this a proper PBKDF2 key derivation function algorithm?
[Here are the test vectors](https://tools.ietf.org/html/rfc4231) for SHA2 based implementations. That said, if you have "implemented some other things that will make the final output different", then you do not have PBKDF2. PBKDF2 is a standard. If you deviate from the standard, you do not have PBKDF2. You should n...
[Here are the test vectors](https://tools.ietf.org/html/rfc4231) for HMAC-SHA2 based implementations. That said, if you have "implemented some other things that will make the final output different", then you do not have PBKDF2. PBKDF2 is a standard. If you deviate from the standard, you do not have PBKDF2. You sho...
It appears there are no official test vectors for PBKDF2-HMAC-SHA256. A StackOverflow user has posted some [test vectors](http://stackoverflow.com/a/5136918/1285942) that others have validated. [Here are the test vectors](https://tools.ietf.org/html/rfc4231) for HMAC-SHA2 which you should also be running. That said...
I wonder: are there any real-world practical applications using the Paillier cryptosystem , as introduced in [1], or some derivations of it? I'm aware of quite a few schemes proposed in literature how to use it for voting, zero-knowledge proofs and such, and also of many prototypical implementations online, but I c...
Paillier Cryptosystem - Practical applications?
I need to generate unique (random) numbers that I can trace back to a unique source number. for example source number A can generate numbers A1, A1, A3 .... Am source number B can generate numbers B1, B2, B3 .... Bm ... source number N can generate numbers N1, N2, N3 .... Nm All the source numbers A, B, .. ...
I need to generate unique (random) numbers that I can trace back to a unique source number. For example: source number A can generate numbers A1, A1, A3 .... Am<br> source number B can generate numbers B1, B2, B3 .... Bm<br> ...<br> source number N can generate numbers N1, N2, N3 .... Nm All the source numb...
How to generate unique (random) numbers that can be traced back to a unique source number?
I need to generate unique (random) numbers that I can trace back to a unique source number. For example: source number A can generate numbers A1, A1, A3 .... Am<br> source number B can generate numbers B1, B2, B3 .... Bm<br> ...<br> source number N can generate numbers N1, N2, N3 .... Nm All the source numb...
I need to generate unique (random) numbers that I can trace back to a unique source number. For example: source number A can generate numbers A1, A1, A3 .... Am<br> source number B can generate numbers B1, B2, B3 .... Bm<br> ...<br> source number N can generate numbers N1, N2, N3 .... Nm All the source numb...
I want to create a lottery that works like this: I choose a secret number A in the range [0:999] and publish an object B. People must try to guess the number A to win. When somebody wins, I want to publish an object C. The object C shall now together with B prove the existence of A, such that people know that A was det...
Encryption scheme is called a permutation cipher if every plaintext array a1, . . . , an is encrypted as aπ(1) . . . aπ(n) for some (not necessarily uniform) permutation π. To break this cipher, I just to distinguish two messages based on their encryptions. I'm trying to solve this by playing a game. Two player...
How to prove that the Permutation cipher is not CPA secure?
I wonder: are there any real-world practical applications using the Paillier cryptosystem , as introduced in [1], or some derivations of it? I'm aware of quite a few schemes proposed in literature how to use it for voting, zero-knowledge proofs and such, and also of many prototypical implementations online, but I c...
Lets say $Alice$ needs to send ciphertext $c_b = enc(m_b,k_b)$ to $Bob$ and ciphertext $c_c = enc(m_c,k_c)$ to $Carol$, for both the ciphertexts notice that underlying plaintexts are different (i.e. $m_b, m_c$). Now imagine a single envelope needs to be sent to both $Bob$ and $Carol$ where both of decrypt and get ...
I am encrypting files in a two layered fashion as follows: 1. Inner layer is 128 bit AES-CTR encryption 2. Outer/Second layer is a simple one time padding with a particular key. While testing the running times I noticed that it takes same time to encrypt a 100kB file as it takes to encrypt a 10kB file. L...
In May 2015, header files were uploaded to the OASIS PKCS 11 TC document repository by Dina Kurktchi-Nimeh that were versioned v2.4.0. However, they were uploaded to the "Working Drafts" folder. The meeting minutes from 2015-04-15 state that v2.4.0 is complete, but there is an action item for Dina to publish header fil...
apprSVP is the problem where basis and the approximation factor gamma( function of dimension n) is given find the vector that belongs to lattice L s.t its norm < gamma times (length of the shortest vector in the lattice). But, it is hard to find even the length of the shortest vector then what value should be substitut...
In May 2015, header files were uploaded to the OASIS PKCS 11 TC document repository by Dina Kurktchi-Nimeh that were versioned v2.40. However, they were uploaded to the "Working Drafts" folder. The meeting minutes from 2015-04-15 state that v2.40 is complete, but there is an action item for Dina to publish header files...
After having read the [rfc][1] and [this][2] article I'm not sure how a nonce should be picked as: > 2. A nonce N of 15-L octets. Within the scope of any encryption key K, the nonce value MUST be unique. That is, the set of nonce values used with any given key MUST NOT contain any duplicate ...
All implementations of CMAC that I have found so far use a block cipher with the same key and block size. However, XTEA enciphers a 64 bit block by using a 128 bit key. If `E_XTEA(key,block)` is the encipher function and `k` is my main key, CMAC produces a temporary key `k0` from an all-zero block: k0 = E_XTEA(...
OMAC1/CMAC with XTEA? (different key and block sizes)
Encryption scheme is called a permutation cipher if every plaintext string with letters $a_1,\ldots, a_n$ is encrypted as $a_{\pi(1)}, \ldots, a_{\pi(n)}$ for some (not necessarily uniform) permutation $\pi$. To break this cipher, one has to distinguish two messages based on their encryptions. I'm trying to solve t...
After having read the [RFC 3610: *Counter with CBC-MAC (CCM)*][1] and [the Wikipedia article on CTR mode][2], I'm not sure how a nonce should be picked. The RFC says: > 2. A nonce N of 15-L octets. Within the scope of any encryption key K, the nonce value MUST be unique. That is, the set of nonce ...
The approximate [Shortest Vector Problem](https://en.wikipedia.org/wiki/Lattice_problem#Shortest_vector_problem_.28SVP.29) (apprSVP) is a problem where, given the basis and the approximation factor $\gamma$ (a function of the dimension $n$), one must find a vector $v$ belonging to the lattice $L$ such that its norm is ...
Subkey generation in OMAC1/CMAC with XTEA?
I hear it commonly said that the advantages of Symmetric encryption are speed and no limit to the amount of data that can be symmetrically encrypted. I also hear it commonly said that the advantages of Asymmetric encryption are security. But theoretically, if I want to symmetrically encrypt a 1TB file, my algorit...
What are the practical limitations of Asymmetric encryption vs Symmetric encryption?
I note that [Things that use Curve25519](http://ianix.com/pub/curve25519-deployment.html) provides a long list of protocols, software, and libraries that leverage curve25519, but I'm wondering if there is any such software that more fully implements a self-contained PKI ecosystem? For example, implementing the ability...
Where can I find a versatile PKI and library leveraging curve25519?
Is there any tool which can be used to test that implementations follow FIPS 140-2 Compliance ?
I am new to crypto and wondered what would happen when we encrypt twice using any algorithm and the same key. Consider two block ciphers A and B. We generate the ciphertext as c = A(B(m)) for any message m. If they are in the same message space and they map to the same ciphertext space, why would using the same key ...
The advantage of asymmetric encryption is not security, it is capability. Asymmetric crypto provides completely different capability that you can't get with symmetric crypto. With symmetric encryption, you have to establish a key *a priori*. With asymmetric crypto, you can establish a key on the fly (granted you have t...
I'm new to cryptography. I want to ask about OTP-perfect secrecy diagram like figure below: [![enter image description here][1]][1] On the overlapping region (middle), notated by R(X;Y;Z) is symmetric in X, Y, Z and can be negative. For example when X and Y are independent bits, and Z = X xor Y, then I(X;Y) = I(X...
What is the meaning of the overlapping region on OTP-perfect secrecy diagram?
I'm new to cryptography. I want to ask about OTP-perfect secrecy diagram like figure below: [![enter image description here][1]][1] On the overlapping region (middle), notated by R(X;Y;Z). R can be calculated by I(X;Y) - I(X;Y|Z). That region is symmetric in X, Y, Z and can be negative. For example when X and Y a...
I'm working on a security application for RF modules aimed to protect a communication between an autarkic sensor and a line-powered receiver against MITM (man-in-the-middle attacks). I decided to use a communication approach based on a unilateral authentication using a 32-bit random as Nonce with time limited validati...
concatenating two uint16 into an uint32.Is it sure?
I'm working on a security application for RF modules aimed to protect a communication between an autarkic sensor and a line-powered receiver against MITM (man-in-the-middle attacks). I decided to use a communication approach based on a unilateral authentication using a 32-bit random as Nonce with time limited validati...
Is it secure to concatenate two 16-bit random numbers into a 32-bit one?
The simple way to iterate a hash function $H(H(m))$ only makes brute force preimage finding slower, but leaves collision attacks as fast since a collision in the inner hash function is a collision in the overall function. Is there an iterative algorithm that also slows down brute force collision attacks? Without exp...
Is there a way to slow down collision attacks using iteration?
> Given a scenario, e.g. my Dropbox was hacked, and the hacker has access to my EncFS encrypted texts, and probably the history of it as well. Is that what was mentioned as *"two or more snapshots"* and *"different times"*? Whether it applies depends on how the storage system would work. As far as I can tell, EncFS ...
I'm currently implementing, with `crypto++`, and AES tranmsission system, whose `key` is based on a previous `MasterSecret` of 256 bits (which has been expanded using PBKDF2). This `MasterSecret` is then split into a `key` and an `iv`, to encrypt a message using `AES-GCM`. I **must** work with AES-256, so my key ...
I am encrypting files in a two layered fashion as follows: 1. Inner layer is 128 bit AES-CTR encryption 2. Outer/Second layer is a simple one time padding with a particular key. While testing the running times I noticed that it takes same time to encrypt a 100kB file as it takes to encrypt a 10kB file. Logically...