instruction
stringlengths
32
27.2k
Given that: You should always use proven secure hashing and encryption algorithms, rather than attempting to write your own. What's the process for criteria for an algorithm being proven? Is it necessarily a peer review process? Does an algorithm need to withstand exploit attempts for N amount of time by M many exp...
This is a classical scenario: For our web based authentication platform we have a username and a password field. User enters these values and presses Log In. The browser gathers the user data, calculates a digest of the password and sends everything to the server side. We don't want to send the password over the networ...
I often heard about private key storage, but rarely about key life cycle in memory. For example, when SSL is used from one peer, the private key is used to sign messages or decrypt other peers' messages, so it has to be in memory as long as the http process goes on. It may raise some security issues that clear private...
Carter-Wegman MAC variants (VMAC, UMAC etc) are known to be very fast and efficient when compared to MAC algorithms that are based on block ciphers and compression functions (like HMAC, CMAC etc). However, Carter-Wegman MAC variants are not very popular on the internet like HMAC. Why is this so? Do Carter-Wegman MAC va...
I have been reading up on IND-CCA2 security and was wondering: Are there efficient IND-CCA2 secure schemes that do not require plaintext awareness? I'm guessing yes - could someone point me to these schemes? I was looking at Cramer-Shoup, and it seems like the general idea is that we make the message complex so that it...
I am trying to implement an FPE for a 19-digit long number. I am trying to follow the lecture of Prof. Dan Boneh and here is how I understand it: Get the nearest power of two greater than $10^{19} \rightarrow 2^{64}$, Get the binary representation of the 19-digit number, Split the 64-bit long binary representation int...
In the ElGamal signature scheme we calculate a signature for a (hashed) message $m$ as $r \equiv_p g^k$, $s \equiv_{p-1} (m - xr) k^{-1}$ and verify it by checking $g^m \equiv_p y^r r^s$. Here $r$ is a group element which is in some cases used as an exponent. This is not a problem, as long as the group elements are jus...
Below is a short excerpt of available DH cipher suites available on a machine. I understand EDH is ephemeral DH, and that ECDH is for Elliptic-Curve DH which is computationally faster. ECDHE is both of those aspects together. The confusing bit how there are EDH cipher suites and DHE suites. The wikipedia article say...
Background: Hello, I'm working on a hobby project in which I might want to implement a key derivation function within a somewhat resource limited embedded system. For standard crypto functions, I only have access to SHA and AES (no KDFs). So, I was thinking of rewriting one of the standard ones (like bcrypt or scrypt) ...
Would variants of AES provide the same level of security as AES, say by just replacing the S-box with another one, MDS matrix of Mixcolumn, etc.?
I am new here and fairly new to cryptography, so if I say something wrong, let me know. I am trying to set up a system where a user can receive a temporary license key over the phone, put it into the system, and get the privileges and expiration date which was encoded into the license key. The limitation for this key...
I use AES both CBC and CBC-MAC to encrypt some stuff. I generate one key for CBC and one different key for CBC-MAC. Does the second key (for CBC-MAC) need to be secret? How to join such key with the ciphertext? By contatenating it at the end?
Haven't found any clear cut answer in Google so its up to you guys: DK = PBKDF2(PRF, Password, Salt, c, dkLen) Here, what is the upper limit of password length? I tried up to 16 characters and it works. How far can I go? I read somewhere that salt has no upper limit! Is it really true?
I have one question about convergent encryption. Suppose I use AES-256 in CBC mode. I need a 256 bits key and a 128 bits IV. If I use SHA-256 to hash one file, then I can use directly that hash as the key. When decryption occurs, is integrity and authenticity given by checking the hash of the decrypted plaintext, OR is...
In general (if possible to determine) which would make an output harder to turn into plain text with a computer? Extreme Length (minor complexity change) Extreme algorithmic complexity (minor length change) (Assuming these are hidden patterns of course) Possible simple example for length might be a sentence turned nu...
I'm working on a project where we need to encrypt a large number of files and store them on the cloud. And I'm wondering if the following process would be secure (we have a “Hardware Security Module” and an “encryption server” in a private data center, only the files will be in the cloud). Since the volume of the files...
I desire an algorithm in which Alice sends a block of data $X$ to Bob, with proof that the data was both sent and received. Ideally this would take the form of a public-key signature of the block $X$ by both Alice and Bob, so that each is in possession of (X + sign(X,A) + sign(X,B)). Further let us assume that Alice a...
I've read lots about null-length IVs being bad for most modes. In a scenario where passing a 128-bit IV along with each message isn't feasible, how would generating the IV from a smaller passed-along value impact the strength of security? Each user will have their own symmetric key that does get re-generated periodical...
Is there an efficient way to map $2^n$ unique 64-bit vectors to $2^n$ $n$-bit vectors where $n < 64$?
Cipher modes typically assume data is streamed or read from a reliable channel with guaranteed ordering. However, many communication transports, such as UDP, are not reliable and don't guarantee order of delivery. I can imagine that there are are some cipher modes which are packet-oriented and can deal with unreliabl...
Is there a table (or a whitepaper from official sources) that compares the size of X509 certificates generated with RSA (starting from 1024 bits) and ECDSA (starting from 160 bits) ? Thanks for the support.
Is it possible keep the "one wayness property" of certain one way function in Merkle-Damgård construction? I'm asking this question because according to Collision-Resistant hashing: Towards making UOWHFs practical the target collision resistant property fail in Merkle-Damgård construction.
I am learning Groth-Sahai NIZK proof system for Bilinear groups. While going through the literature, I am getting confused on how the proof system is related to Subspace Decision, SXDH or DLIN assumptions. In the proof system, what I understood is to prove the ownership of solution of a set of equations, e.g. Quadratic...
After reading about public/private key cryptography, there are still a few points I don't really understand. Based on the way (I understand) challenges work, the public key is used to encrypt a sequence which the private key can be used to decrypt: When a key pair is freshly generated, does it matter which key that is...
Suppose: The "counter field" is about: NONCE || CTR-VALUE. I have multiples messages $M_a, M_b, M_c, \dots$ Each message can be divided into x-bits blocks ($M_{a1}, M_{a2}, M_{a3}, \dots$). Each message $M$ (for instance $M_a$) is encrypted following a randomly and uniquely generated key. In this case, does I really ...
I am looking for any cryptographic solution that will meet those requirements : Only known method to get the encrypted string need to be brute force. Decrypting on modern computer not more than around 1000 decrypting operations per second. (in other words, only 1000 bruteforce tries per sec) Very fast encryption, with...
I'm holding a cryptography workshop for teenagers (around 16 years old) at our university. As part of the workshop, I'm planning to run a crypto competition with prizes: there will be different tasks, each one will yield points, and the winners will get sweets. However, for the amount of time I'm planning to kill with ...
In symmetric cryptography, a scheme is not considered secure if the data transmitted is only encrypted. The adversary will be able to modify messages to generate encrypted messages of his choice without having the key. Is this applicable to asymmetric crypto such as RSA?
Let us assume the following scenario: I have just found a way to crack AES-128 in a reasonable time (1-2 days). How do I publish and prove this? I remember reading about lots of people who cracked DES and other ciphers but how did they publish their work?
In light of the NIST Dual EC DRBG scandal, I was intrigued by a NIST slide (slide 9) that said the two points P and Q can be chosen so that the chooser can prove they don't have a backdoor. This seems rather magical to me, so I'm looking for some more information. I'm assuming they're referring to something more subst...
Is OCB as secure as GCM or CCM ? Since OCB design is quite different from GCM and CCM, I was wondering if the security properties of these latters are satisfied by OCB, as well.
Assumes that we have 3 signature algorithms, $S^A$ with key pair $(sk^A,pk^A)$, $S^B$ with key pair $(sk^B,pk^B)$,$S^C$ with key pair $(sk^C,pk^C)$. We denote by $\epsilon$, $\epsilon'$ and $\epsilon''$ the advantages for breaking $S^A$, $S^B$ and $S^C$ respectively, in the sense of weak unforgeability. I have a compos...
OMAC is specified as the underlying algorithm to provide authentication within the EAX authenticated encryption (with associated data). Would that be OMAC1 or OMAC2? If it is OMAC1, does that mean it is identical to AES-CMAC if EAX mode uses the AES block cipher as primitive?
I've read the following two sentences within a beta protocol specification, which references ISO/IEC 7816-8 for PSO:HASH which already contains notions of a "partial hash". The off-card entity is responsible of computing the intermediate hash over the first part of the data to be signed. The intermediate hash-code is ...
If there are $n$ servers for broadcasting a symmetric key in such a manner that following holds: No server alone can find the key $K$ alone. Any two servers can pass $k_i$ and $k_j$ such that $K=f(k_i, k_j)$ where $i\neq j$ How can a symmetric key be distributed between $n$ entities?
I am currently reading about PBKDF2, and understand that the salt is used only once, while the password is used multiple times in the computation of the final key (see this question). How would the integrity of PBKDF2 change if the roles of password and salt are changed?
I just recently learned that the SHA-3 finalist Keccak allows for variable length output. As the only answer to this question states, "[it] need to have an output length at least equal to the input length," which I understand just fine. However, I'm curious if this guarantees against collisions. Is there any work done...
I recently came across an interesting paper detailing the use of hardened session cookies. Each cookie includes a preimage of the password hash, and the preimage is hashed once more and compared to the stored password hash as part of the cookie authentication process. In order for this to work, we must be able to quic...
I have been studying the Diff. Cryptanalysis and finding it hard to do a problem. The problem is I have calculated the tables programmatically and found that the second table has a max value of 6 where as the first has a max value of 4.What can i infer from the tables? PS:I started reading this recently and need help ...
As stated in the HMAC RFC (RFC 2104): The strongest attack known against HMAC is based on the frequency of collisions for the hash function H. How can a collision benefit an attacker? I would have thought that the strongest attack would be a brute force attack aimed at discovering the secret key.
I have an arbitrary long list of hashes (e.g. git tree hashes), and I'm wondering by how much I am increasing the risk of hash collisions by condensing them into a single hash, like so: import hashlib ... rehash(list_of_hashes): return hashlib.sha224("".join(sorted(list_of_hashes))).hexdigest() My feeling is that ...
What's the point of a Meet In The Middle attack while using, for example, a double AES encryption and using one time keys? You can recover the keys for a secret message already known and you can't use those keys to retrieve other secret messages. So why would an attacker use it?
Both client and server know a shared key in advance. Both sides us EVP_BytesToKey() derive a pair of same key and same IV. Then, client and server start transferring data encrypted by AES-CBC mode using this pair of key and iv. Is there any possible CCA or CPA? Should I use randomized IV every time? Is it safe to trans...
Is it true that first time RSA algorithm was rejected by a journal?
I am currently trying to implement a very fast and simple encryption algorithm in Lua for the purpose of using it with ComputerCraft. The main problem is that bitwise operations in Lua (5.2 at least) are very slow and the implementation ComputerCraft can only handle 32 bit integers in their bit-library, so implementing...
I asked this at bitcoin.stackexchange.com first, but it seems that this is more of a crypto-question anyway. I'm interested in using a Hierarchical Deterministic Bitcoin wallet branch as a "shared secret" between two parties. Basically one party could send an index (in plain text) to the other party, along with some se...
I'm pretty sure that by now folks might have come across this research from Genkin-Pipman-Tromer (GPT) on extracting the RSA key used by GnuPG (GPG) just by measuring the ground potential. I'm going to call it the GPT attack on GPG for short. I have done work on extracting informational content of a processor core by s...
There are several well-regarded block cipher modes for authenticated encryption which have made their way into standards and protocols: CCM, EAX, GCM, OCB, … If I am designing a new messaging or storage protocol which requires both confidentiality and authenticity of the data, how do I choose between these modes? I am ...
I'm trying to understand why some key stretching methods are better than others. The wikipedia article presents 3 different key stretching methods: A collision prone simple key stretching method: key = hash(password) for 1 to 65536 do key = hash(key) A better simple key stretching method. ("+" denotes the opera...
Is there a safe way to do crypto that will always produce the same result for a given input? My use case is transferring deltas of huge files, to a backup server. The backup server has no knowledge of what's in the byte stream (and it shouldn't). In order to transfer only the changed parts of the file, any block that h...
I am new to Crypto field. Many papers are boasting of not using Random Oracle model. Instead, those prove security in Standard Model. I am surprised how do these models differ. Can anyone please clarify me? Does using Hash function mean that the paper makes use of Random Oracle?
I have been looking at both the paper as well as the sourcecode of Spritz — a spongy RC4-like stream cipher and hash function by Ronald L. Rivest and Jacob Schuldt. The paper states We have also performed extensive simulations to look for detectable statistical biases, and selected a candidate with no biases detected...
I'm reading “Efficient Identity-Based Encryption Without Random Oracles” by Brent Waters. In Page 9, I don't know how $$\mathcal{P}_{BDH}=\Pr[\beta'=1]=\Pr[\beta'=1|\textbf{abort}]\Pr[\textbf{abort}]+\Pr[\beta'=1|\overline{\textbf{abort}}]\Pr[\overline{\textbf{abort}}]$$ becomes $$\mathcal{P}_{BDH}=\frac{1}{2}+\frac{1...
Let's suppose we have a asymmetric crypto-system $H$ which is homomorphic with respect to some function $F$. Alice encrypts a message $m$ with her private key $e$ in the crypto-system $H$ and obtains the ciphertext $C = H(M)$ Alice sends $C$ to Bob Bob computes $F$ over $C$ and obtains $C' = F(C)$ Bob sends $C'$ to Al...
How do we verify practically the strength of a block ciphers? Most of the security analysis of block ciphers is usually around theoretical analysis and proofs in some random oracle model etc. For example, for our recently designed FNR encryption scheme, we have only given results based on previously done theoretical w...
I am working on an implementation of the Mceliece Encryption system (MCE) and the Niederreiter encryption system. I have been through the basics of finite fields, polynomial arithmetic and some coding theory to understand it. In brief given MCE parameters $n, k, t$, such that it is over $GF(2^m)$, $n = 2^m$, $k = n - m...
Assume: We have a centralized data store that can store whatever we need Every user is online Function $f : File \to Key$ gets access to the store, and is the same for all users. $g : Key \to File$ should retrieve the file so that $g \circ f = id$. Eve can't break modern algorithms. Then: Eve wants to know who inse...
I want to generate a key pair such that the private key can be used once to sign a small message (1024 bytes) at some indeterminate point in the future and the public key can be used to verify that signature, what can I do to get better security than a regular asymmetric algorithm (e.g. RSA)? The use case is allowing a...
I want to manage authorization, as 3rd-party permissions, through asymmetric cryptography. I'm concerned about how it is possible to share access of encrypted data with N entities, be able to revoke any of them at anytime, and do this securely. I've thought about a cryptography function that I'm asking here some help t...
In my question (and answer) about a partial hash code used within a signature application I found out that partial hash codes are sometimes used within protocols with a relatively restricted security tokens such as smart cards. In the comments below the answer I mused that the partial hash makes sense over a full hash....
Why is the block cipher in the CBC-MAC taken to be a pseudo random permutation (PRP) and not a pseudo random function (PRF)? We don't need the bijective property of the PRP. So why go with it?
I am using ElGamal ECC to encrypt my plain text data. I want to ensure that my data is safe from a Man-In-The-Middle attack. What methodology I can adopt to achieve this goal? How can we prevent a Man-In-The-Middle attack while encrypting data by using ElGamal ECC?
In general, the idea of multiple encryption sounds interesting - for creating stronger cyphers (especially against implementation bugs), one could always get the configuration details wrong and mess it up. So I wonder: if one starts with NaCL, which is supposed to have a default configuration that's very hard to mess ...
If the goal is to demonstrate that you are who you say you are, I think the following will work: Bob wants to know that you are Amy. Bob encrypts a number using Amy's public key and then asks her what that number is. If Bob gets back the number, "Amy" at least had Amy's private key. From what I have read, this is not w...
I have been reading about SHA-2 family and I found a lot of in depth details, but I am confused about how it is related to TLS and AES. TLS encrypts data between server and client, but does it make use of SHA and for what, like what kind of data?
I would like to know if there exists a protocol which performs the following operation in a privacy-preserving fashion: User $U$ wants to know whether a record is stored in the database. The primary key of the record is an id which is known by the user. User $U$ sends a "private" query containing the record id. The da...
anyone knows any reference that proof it ? Please Help .
I'm reading FSB cryptographic hash function and the authors say that security of this function depends on NP-Complete Problem: "Decoding Linear Code Unlike most other cryptographic hash functions in use today" and I'm agree with the first part of claim. But I have a doubt respect to conventional hash functions for exam...
How is it possibile to cryptographically make a document truly read only? As in read only I imply that the user can obviously view it which can be achieved by coding which pixels have which colors. But how is it done in the industry? and what's more important is it possibile to password-protect it too? I have considere...
The MAC algortihm which is used along with a secret key to generate a MAC tag on the sender end ,is it same at the receiver end also who again uses a MAC algorithm to generate a tag? If yes, then how is the MAC algorithm generated. Is it just a function(a mathematical function to compute)?? If no, then how does the tag...
While going through this paper, I came across the idea of Set Membership proofs. The proof allows a prover to prove that a value is contained in some set. The point where I am confused is, all the elements of the set are known to the prover. All three steps of the proof generation can be run by anyone including the pro...
We know that MAC algorithm and key are used in both sender and receiver side to get the matching MAC tages to prove that the data is authentic. Now in HMAC we know that, it makes use of crytographic hash function which is irreversible, so when we use HMAC from the sender side to encypt a message using the HMAC formula,...
In SSL/TLS, we use symmetric and asymmetric keys to encrypt the data. Does that mean that the keys are used to encrypt the data (preserve the integrity) or provide a secure channel for the data to be sent? And as far as I know, hashing algorithms – inside of the SSL handshake protocol – are used to provide data integri...
Suppose a $1000$-bit key used in the one-time pad is not randomly and uniformly generated. Suppose that the values of the first $5$ bits are $0$, and the other $995$ bits are randomly generated and uniformly distributed (each bit with value $0$ and $1$ with probability $0.5$), what is the entropy of the key? Suppose...
Description of intermediate hashes Intermediate (or partial) hashes are canonical forms of digest state that can be transferred from one hash implementation to another, so that the other, limited device (e.g. a smart card chip) can finish the hash calculation with the remaining data. This scheme is used to create a sig...
Is a length padding technique in a hash function used to avoid length extension attacks ?
What is the minimum number of unique pairs of digests and inputs to a one-time pass needed to verify that a secret is equal to a given s where the output is an integer with of at most digits base-10 digits. My back-of-a-napkin calculation is the ceiling of: log(cardinality(s)) ÷ log10(digits) For example, in the case...
ECB is considered to be insecure when used for confidentiality because identical plaintext result with identical ciphertext. But what if we use ECB for authentication? Assume A wants to transmit an authenticated message X to B. A and B have a shared key. What if A encrypts the plaintext X using AES-ECB and outputs Y as...
Which public key encryption scheme is re-randomizable? Is there any library for re-randomizable encryption scheme? If not, how can I re-randomize a given public key encryption scheme? I cannot find any papers about re-randomizable encryption.
I have learned from Applied Cryptography that triple encryption with three independent keys in encryption-decryption-encryption (EDE) process gives security not higher then $2^{2n}$ when it comes to meet-in-the-middle attack, where $n$ is keysize. If the triple encryption is done in encryption-encryption-encryption (EE...
The DES retail MAC, also known as ISO 9797-1 mode 3 with DES, computes the MAC of a block of data using a 16-byte (112 bit) key. It can be seen as CBC-MAC using simple DES with the first half of the key for all the blocks, except the last where 3DES with the full key is used. I've left padding and truncation out of the...
I'm implementing a format-preserving encryption scheme similar to those described in the literature. I want to sanity test my PRP using some statistical tests like TestU01. However, I'm not sure how applicable these kinds of tests are to PRPs since they are designed to test PRNGs. Are there statistical tests that are P...
Recently, I was given three ciphers to crack for my cryptography class. At this point, I have guessed that one of them is likely a Hill cipher (probably 3x3, as that is the most complex we have done so far). I have made a fairly good guess of two options for the first seven characters in the cipher, but I found myself...
Prove that if only one character is encrypted using a shift cipher, then the shift cipher is perfectly secure. I want to show that $P(P=p | C=c)=P(P=p)$. But I don't know how to relate. Can anyone guide me?
The paper “Residuosity Problem and Its Applications to Cryptography” considers the exponent to be an odd integer. When $k = 2$, it is called the quadratic residuosity problem (mod $n$, where $n$ is composite) which is hard and can be solved if the factorization of n is known. What happens to the $k$th residuosity probl...
Assume a password storage scheme using a computationally-expensive hash algorithm and a CSPRNG salt. User ID, salt, and hash value are stored in a table; if the table is compromised, all three values are available to an adversary. Is there any value in computing a new salt when a user changes his password? (I think ...
Curves secp256r1 and secp256k1 are both examples of two elliptic curves used in various asymmetric cryptography. Googling for these shows most of the top results are Bitcoin related. I've heard the claim that… Satoshi picked non-standard crypto which conventional wisdom says will be cracked in 5-10 years. There is th...
We are implementing searchable encryption techniques proposed by Song et al in Java for a paper[1]. The schemes need a Stream Cipher for achieving search over encrypted data. The stream of random bits should be reproducible later while decryption given the same "Seed". Now we plan to generate the stream of random bits...
Assumptions: $A$ wants to communicate with $B$ $A$ knows a public key $P_B$ which is trusted by a third party and belongs to $B$ $A$ knows the address of someone who pretends to be $B$ $A$ wants to send a message to $B$ using ECIES: $A$ calculates a random private key $K$ and the related public key $P$ $A$ calculate...
Assuming $$AES_{k_1}(C_1) \oplus AES_{k_2}(C_2)$$ where AES is used in CTR mode, $C$ is a 128 bit incrementing counter, keys and counters for both transforms are random as well as unique, and the XOR occurs on every 16 byte block. If I did this, would the XORed output be less secure than the size of state used to seed ...
According to Wikipedia the ECIES algorithm has two optional shared information $S_1$ and $S_2$. They are used as follows: Generate a random shared secret $Z$ according to ECIES, which will never be reused Derive symmetric keys $k_1|k_2=KDF(Z_x|S_1)$ Encrypt the message $c=\text{ENCRYPT}_{k_1}(m)$ Tag the encrypted mes...
Using $SHA256(N)$, where $N$ is 64 bytes of output from the Microsoft Windows CryptGenRandom function. Are there any known vulnerabilities with using this method to create key material? Should $N$ be more than the SHA256 block size of 64 bytes? Aligning to block size means 2 passes through the (internal) hashing functi...
I'm currently interested in the problem of generating random-looking URLs from sequential database IDs, like how they do it in link shorteners. One way to do this is to encrypt the sequential database ids using a 32 bit block cypher and base62 encode the result so it can be written to the URL. For example: foo.com/1 ...
Why is Rijndael restricted to key length in $\lbrace 128, 160, 192, 224, 256\rbrace$ bits (and not larger)? The algorithm looks to me like it would support an arbitrary-sized key (multiple of $32$). The rounds operate without the key. Between rounds, the state is XORed with as many key bytes as are needed according to ...
I'm trying to crack my thermostat's network protocol. I've captured several rounds of network traffic and here is what I've got to work with. Communicating via HTTP POST The POST data is JSON followed by ciphertext. The JSON contains: A device unique id: 48 bits An eiv (initialization vector?): 128 bits The minimum ...
I am looking at G now, but is there a better, (in terms of security and speed), means by which a byte array can be expanded that doesn't involve another cipher, just a simple algorithm? I need to expand 1024 bytes to 4096 for use in a stream cipher, and speed is less important than overall distribution of entropy. I am...
It may be a silly question, but I am really curious. If a hash algorithm uses Base64 in the process of hashing a string, for example, it is still considered a hash algorithm, even though it uses an encoding algorithm in it's process?
I read the document(not the whole document) from Shannon where he speaks about the concepts of confusion and diffusion. I read in many places(not in the document but around the internet) that confusion is enforced using substitution. Diffusion is enforced using permutation/transposition. Ciphers must use both of them b...
(Crypto Gods, I should begin by stressing that I haven't lost my mind: I'm not doing this in real life, I'm just trying to understand the theory behind what's happening. With your help, hopefully I can do that.) Let's say I choose the parameters for a linear congruential generator $L$, and pick a seed $L_0$. I then use...
In FIPS 186-4, page 32, about FFC crypto it is required that the length of $p$ will be exactly 1024 bit and the length of $q$ will be exactly 160 bit. Why is the requirement not stated in terms of lower bounds? For instance, any $p$ with length greater than 1024 bit would be good, and any $q$ with length greater than 1...