instruction
stringlengths
33
27.2k
I'm currently prototyping something with the NTRU encryption scheme but I wish to use it in "reverse" -- distribute private keys so anyone can decrypt, but keep the public keys secret and thus only allow certain entities to create new messages. Is NTRU still secure under such a scheme? It seems from the literature that...
I often encounter the phrase "I am not a cryptographer". Is there a generally accepted definition for who is a cryptographer? What qualifications would be expected? For instance, should that person be expected to hold a relevant degree, or to have published $N$ papers? Alternatively, would someone performing cryptana...
I need to convert elements of the finite field $GF(p^k)$, where $p$ is an odd prime, to octet strings. To be more precise, I want to include elliptic curve points over $GF(p^2)$ in a Subject Public Key Info of an X.509 certificate. In the document IEEE P1363 there is a FE2OSP function which is probably not usable for t...
I know about ElGamal scheme and its key generation, encryption, and decryption methods. I'm not sure about what is meant by batch ElGamal. Can someone please clarify it. How it differs from ElGamal and what are the attacks possible on that scheme. How do we prevent them?
I would like to implement a protocol using elliptic curves. I'm thinking of using MIRACL so using curves in their Weierstrass form is preferable as it they are supported by this framework. I don't want to start picking random curves, so I am looking at the available safe curves. None of the curves is in Weierstrass for...
Consider a scenario in which a group of people use a common modulus $n$ in the textbook RSA crypto system, where $n=pq$, $p$ and $q$ are large distinct prime numbers. Is there any chance for an attacker outside the group to view the original message? Let me explain my solution. Assume the group members receive the sam...
Anonymity and authentication look to be seemingly contradictory but are both possible together ? I tried reading couple of papers but could not get the big picture. So what are the major approaches tried in solving anonymity preserving authentication ? (Am not really looking for references or recommendations but the so...
Several years ago a group of malware authors began using code like this: for (j = 0; j < length; j++) ptr[j] = (ptr[j] ^ VALUEA) - VALUEB; for encoding, and this to decode for (j = 0; j < length; j++) ptr[j] = (ptr[j] + VALUEB) ^ VALUEA; I've recently seen this pop up in seemingly legitimate software. This leads m...
I am interesting to learn the low level implementation of Efficient Fully Homomorphic Encryption from (Standard) LWE and I am wondering if anyone can answer the following questions: Does the BV scheme work on binary numbers (0,1) or not? Does the BV scheme encrypt and decrypt each bit separately? Is there any diffe...
Root certificates are normally self-signed. What is the reason behind that convention? I mean, one must trust the root certificate in a non cryptographic way anyhow.
Take an elliptic curve cryptography public key (x, y) and its additive inverse (x, -y). How do you identify which is the positive point and which is the negative point? Examples: Private key 1 -> (x, y) x = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798L y = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b4...
I know various applications of RSA signatures. I wonder, is there any real-world applications of ElGamal signatures and encryption?
Treyfer for example has slower diffusion in decryption. It has full diffusion between words in 2 rounds for encryption and 7 rounds for decryption. Do we have to consider the (bad) cryptographic properties of the decryption algorithm, if we're only using the encryption algorithm? (For example we are using Treyfer in CT...
I have to show that the following construction of $q$ allows to factorize $N$ : $p \in \mathbb{P}$, the set of primes $q \gets p \cdot \left((p - 1)^{-1} \bmod e\right) \bmod e$ $k=1$ while $q \not \in \mathbb{P}$: $q \gets q + k \cdot e$ $k \gets k + 1$ end while I tried to analyse $N \bmod e$ and transform...
I am thinking about this problem: The server has a two-column table $T=\{c_1,c_2\}$. A user has a query $q$ that is sent to server. The server find an item $x$ in the first column satisfying $x=q$ and return the item $y$ in the second column to the user ($x$ and $y$ are in the same row). The requirements are that: ser...
Can we implement Encryption Algorithms like RC4,AES and DES in Verilog? if no what are the limitations?
I'm working on a project in MCU (micro controller) environment with GPRS connection to exchange data securely with the cloud. The encryption algorithm has been selected to use AES. I did some search on internet and figured out that ECDH key agreement protocol quite fits the requirements. The good news is that there are...
My question is about how difficult is for someone having compromised the PSK and sniff all (DT)LS handshake, (so getting the NONCE), to get the encryption keys? I understand : getting the pre-master secret is straight forward but then, what about the master secret MS? because MS is calculated with PRF_HMAC_SHA256 whic...
In the BPS specification document it says We denote by f the number of output bits of the internal function F What is this if the internal function is AES? Would it be the block size (e.g. 128)?
I was presented with this seemingly paradoxical information, and am hoping someone can explain what I'm missing here. I have an encrypt-and-mac scheme here.If I want to transmit message m to Bob, I'd first Enc_k1(m) = c, MAC_k2(m) = t, and then send c||t over to Bob. So far, I understand that this scheme provides no in...
I am new in cryptography domain and try to build some understanding on RSA key pair generation. My doubt is on RSA public key exponent value . Can exponent be any value (prime or non prime numbers)? i am not getting proper answer for this. if someone has useful link for this please help to share. Regards Nikhil
I need an algorithm that can take an integer, an arbitrary range, a key of 16/24/32 bytes, and an initialization vector of 16 bytes(ideally), and return an integer in the same range. My latest attempt at this repeatedly encrypts an integer with AES_OFB until it is in the requested range. I'm using a stream cipher so th...
I am using a vendor library that signs a text producing a PKCS#7 message. I'm not sure of the content of this message. Does a pkcs#7 message have to contain the signed message, the certificate, the payload? Does it have to start with ----BEGIN PKCS7---- and end with ----END PKCS7----?
i want to generate an RSA public public key file using openssl (or other tools) having public modulus and exponent, so i can use it later to encrypt files i have this: the modulus: "BEB90F8AF5D8A7C7DA8CA74AC43E1EE8A48E6860C0D46A5D690BEA082E3A74E1" +"571F2C58E94EE339862A49A811A31BB4A48F41B3BCDFD054C3443BB610B5418B" +...
First, this a different take on my previous question: Pailler encryption of small integers to 32-bit integers I have to encode small integers (range 0-50) using the Paillier cryptosystem. Those values will be encountered many times (100,000) in my dataset. Version 1 I encode each of this 51 numbers with different r an...
In the algorithm for BPS Format Preserving Encryption Is this tweak always the same length (64bit)? Why did they choose the length 64bit for the tweak?
EDIT: The model I'm trying to make is "Enigma 1". I learned initially about it from a book called "Code Book" and then looked at it in detail from its wikipedia page. The rotor wiring and other details from https://en.wikipedia.org/wiki/Enigma_rotor_details I am trying to make an enigma machine simulating software. I k...
I read the question Symmetric mutual authentication with client using a derived secret and its answer which, if I'm not mistaken, assert that it should be safe to use the proposed protocol for mutual authentication between a client A and a server B as follows: At commissioning, each client A gets a unique identifier $...
I'm new to cryptography and please clarify if my below assumption is wrong. Lets assume, that two different banks creating CSR and they get identical public and private key pairs of RSA. In such scenario, how does the conflict be managed. Will the administrator be notified about the conflict ? will the CA check for t...
A few days ago, I was asked to sign an online document over DocuSign as well as on SignEasy, any the signature were accepted just by a physical signature sent over email or on the app. They did not even ask me to generate a private key whose public key I should upload to their website. So, I felt that the process quite...
I read this post from Ben Tasker describing how to take control of a powerline network. Since I am interested in security, I tried to do the same thing, to see if it was possible. I used Devolo devices, since those are the only ones I have. I followed the described steps, and failed in "generating the password from MAC...
I am stuck with identifying ciphertext stealing method with the following properties: mode of operation is ECB; recommended padding scheme for this application is PKCS#7, but apparently it is not used; all blocks except the last one are encrypted / decrypted as usual; the last block is not padded, but still encrypted ...
I have several questions on using AES 128bit in the BPS format preserving encryption Which modes are acceptable? (Should the block cipher used at each round be deterministic (ECB) or probabilistic (CBC, CTR etc) What IV to set? Can I set it to the constant zero?
All block cipher modes of operation that I understand are generic schemes. They are not restricted by key size or block size. So why is GCM restricted to 128-bit block size?
I would like to encrypt some files using AES, Ill derive key from password using some standard PBKD function and use that as AES encryption key. My question is, if user forgets the main password, then he has no input into PBKD function thus no way of getting the AES encryption key. What algorithm/technique should I use...
I'm trying to understand why the secret keys used by Alice and Bob in Diffie-Hellman are $a,b ∈ ℤ∗p$. Say $a$ is $p - 1$, wouldn't the transmitted $g^a$ be 1 mod $p$ by $FLT$? Now anytime a passive listener sees a 1 being transmitted would know one of the secret keys and could easily compute the message. I'm sure I'...
In looking at GPG's gen_prime() function, found within the cyphers/primegen.c file of libgcrypt, I noticed that the functions saves a list of the remainders from dividing the initial, randomly generated large number by the first 669 or so small prime numbers. What is the purpose of doing that? I don't see any reasoning...
What would be the recipe to add error propagation to a one time pad? I.e. if I change a single letter in the clear text message, I want the encrypted message to change starting from that letter and up to the end of the encrypted message.
I am maintaining an application that uses PKCS#11 to talk to a smartcard. Somehow a session gets generated, but i cant figure out where in the code. I am using c# and the PKCS11Interop wrapper. The funny thing is that if in my main application i do a slot.GetTokenInfo() i can see that there is one session open, but if ...
Bitlocker as example uses AES 128 Bit encryption as default - if it was brute forced how it can be done , I mean where's the file that will be brute forced to generate the password (If I'm right that file is suppose to be the 128 keys generated from the encryption right?) I'm not asking about software to do this ( I'm...
So I have a kind of interesting issue. I have a field in my data store which must take exactly 160 bits of information. Some users will choose to make this data encrypted, some won't, so some of those 160 bit fields will be ciphertext some will be plaintext. A boolean will indicate which one the user is using. The impo...
Can someone please check my work and correct me if I am wrong, I am just starting to learn about DES. I am trying to solve the following problem: Show that S1(x1) XOR S1 (x2) != S1(x1 XOR x2). x1 = 000000, x2 = 000001 So, we get S1(x1) first: 00 is our row, and 0000 is our column which is (0,0) and in the S1 Box tab...
Given X1 and X2 such that md5(X1) = md5(X2) and Y1 and Y2 such that md5(Y1) = md5(Y2), and knowing the following property of md5: if md5(a) = md5(b), md5(a|s) = md5(b|s) is there a way to find Z1, Z2, Z3, and Z4 such that md5(Z1) = md5(Z2) = md5(Z3) = md5(Z4)?
I have an idea for an research project, but I am first wondering if it has been researched or implemented before. I think I have a way to come up with a set of PRNG algorithms which have the following properties: Information theoretic security (or perhaps even perfect security) of the output is guaranteed if it is gua...
This is for a distributed system: we don't want to have to maintain synchronization of random streams neither enforce uniqueness of pads because this would require some synchronization. Alice and Bob met once. They agreed on a secret (S) and a symmetric cipher (C). Let's assume S is 128 bits in length. Then, they want ...
For example, let's say I want two cryptographically strong RNGs (R1 and R2). And I want them to have the following property: R1 (resp. R2) will never generate the same random number twice. R1 (resp. R2) will never generate a random number that R2 (resp. R1) can generate. Is it possible for three RNGs, 4, N ? Unlike oth...
I'm trying to get into pairing-based cryptography and I don't see why the group order of the group G in the pairing function e:G*G-> G_t has to be a prime number. I don't find an argument why groups of order p^k for a prime number p and some entire number k cannot be used?
Perhaps this has been answered before. Grover's algorithm should result in a 256 bit hash being complexity 128 bits to crack. I was wondering, what if you had a 512 bit hash , and xor'd the lower 256 with the upper 256 bits to result in a final 256 bit hash number. Does this increase the complexity (ie: decreasing th...
I am writing a paper and I got comments from the reviewer that I don’t really understand. Is there any difference between a CPA (Chosen Plaintext Attack) and IND-CPA (Indistinguishability under Chosen Plaintext Attack) when evaluating the security of an encryption scheme?
As I understand, there are a few requirements for a good hash function. Hard to find any message from a given hash Hard to find any 2 messages which give the same hash A single bit change in the input message should lead to change of each bit of the output with a probability of 0.5 (as close as possible to 0.5) Good c...
For all PRNGs (including CSPRNGs) lets say there is a sequence x, y, z, then when the PRNG cycles back to x, then the sequence following it will be exactly the same as before. Is this true for all PRNGs? Are there any rules about minimum cycle length for CSPRNGs used for Stream Cipher? Because if a cycle happens, the...
I'm using ECDH for generating ECDH public parameters (p,a,b,G,n), I try to get this values using openssl ecparam -in cert.pem -text -noout For Generator $G=(x,y)$ I get : Generator (uncompressed): 04:aa:87:ca:22:be:8b:05:37:8e:b1:c7:1e:f3:20: ad:74:6e:1d:3b:62:8b:a7:9b:98:59:f7:41:e0:82: 54:2a:38:55:02:f2:5d:bf:...
I have the trusted root certificate which I am validating using the self signed key. I also have the intermediate certificate, which i am validating using the root certificate. Now when i am validating the certificate do i need to trace back the whole chain to validate the certificate? Or can i say i have done TPC, if ...
This is problem 10 of Chapter 4 "Symmetric Encryption" (pdf) from Lecture notes by Bellare and Rogaway: An IND-CPA secure encryption scheme might not conceal identities, in the following sense: given a pair of ciphertexts C, C′ for equal-length messages, it might be “obvious” if the ciphertexts were encrypted us...
If I use TOTP to generate codes with different "expiration" time, using the same key for HMAC, will I create some kind of weakness?
Bob calculates a private and public key. Bob sends his public key to John. Jeff is a third party unwanted member and manages to snatch the public key mid-transfer. John encrypts his message and sends it to Bob. Jeff again is able to steal this encrypted message for himself. Bob can decrypt the message ...
Everywhere I read, indistinguishability of output from true random is stated as a requirement for CSPRNGs. However nobody bothered to give the rationale for such a strong requirement. Specifically, Yarrow and Fortuna both use a block cipher as the generator, and both limit the amount of output that can be produced by a...
In textbook RSA, the Euler $\varphi$ function $$\varphi(pq) = (p-1)(q-1)$$ is used to define the private exponent $d$. On the other hand, real-world cryptographic specifications require the Carmichael lcm function $$\lambda(pq) = \operatorname{lcm}(p-1,q-1)$$ to define $d´$. It is clear that the $d´$ divides $d$, and t...
I am currently implementing oauth2 bearer token authentication and am storing the tokens bcrypt encrypted. My question is how long should the tokens be to achieve maximum security. E.g. at what length would longer tokens be useless since a bcrypt collision is as likely as guessing the token.
For a report on threshold signature schemes, I have to explain a threshold signature scheme and give a simple example with numbers. A threshold signature scheme is a scheme in which a network of n nodes can only sign a message when at least t of the n nodes agree to sign the message. I'm trying to understand the scheme...
Why does AES file encryption not ensure perfect secrecy? I understand that $\Pr[E(K,M_1)=C_1] = \Pr[E(K,M_2)=C_2]$ given $M1\neq M2$ holds for perfect secrecy of a scheme. However, this seems to hold for any message with AES.
A hash function H is secure in terms of pre-image resis-tance. Does this imply that H has second pre-image (aka weak collision) resistance?
Is a perfect hash function always bijective ? In Wiki "In mathematical terms, it is a total injective function" but it does not mean, that it is bijective.
I have a scenario that uses RFC-3526's Diffie-Hellman Group 14 for 2048 bit key exchanges. From the document, it specifies the P (prime) value in hexadecimal value as: FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 29024E08 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD EF9519B3 CD3A431B 302B0A6D F25F1437 4F...
ephemeral-ephemeral ECDH is it susceptible to MITM attack ? if yes, can you please give me a detailed answer ( Workflow that can be followed by the attacker) and how we can prevent this attack (static-ephemeral or we can keep ephemeral-ephemeral and change some parameters)? Thank you in advance
Here is the POW system: you are given a string and you need to compute a suffix so that first few bits of the MD5 value are all 0. I know MD5 is collision vulnerable, but is it safe to use MD5 here, or, state it in another way, is there a non-bruteforce way to compute the suffix?
So for Playfair, we choose a keyword and put that in the keytable with no duplicates. Then, we fill the rest of the table with alphabets in order that are not in the keyword without 'J'. Does the length of the keyword matter? I am wondering because I wanted to know whether having just a random 25 characters long word f...
I would like to know how to prove I have certain Facebook account (or that I can login to that account).
I'm writing a function to act as a cryptographic hash of a number within a range that returns another number of the same range. The catch is that the result needs to have certain properties. I run a simple test for these properties and call the function recursively if the test fails. Naturally this raises a red flag fo...
I'd like to have a peek at the firmware of a piece of Hardware. Its firmware is available as a .wav file to be uploaded via audio jack. https://drive.google.com/open?id=0B6S_PcWWM1YlQnNwT2FSMnFzVE0 And it sure looks like straight forward frequency modulation. I think I can even make out a pattern: useful signal (8 wave...
If Eve intercepts all the values communicated between Alice and Bob in a Diffie–Hellman key exchange, and applies the hill-climbing algorithm to reverse the modulo function, how will the algorithm know whether it is following the right path?
I have an RSA signature scheme with 1024-bit key where I know the following: Public modulus $N$ Public exponent $e=3$ A lot of signatures Summary: To compute a signature, an MD5 hash is calculated from a collection of byte and the textbook RSA private key function is applied to that. The verification procedure for a ...
For a software, I don't want the user to choose weak keys, so I plan to just read the needed number of bytes from /dev/random to create the needed secret keys. Is it safe to do so?
I believe it contains public key but whose? the site like a bank or the certificate authority who has signed?
Eve takes a fair six-sided die and adds some heavy paint to the side of the die with the 6 on it. This results in a biased die that rolls a 6 with probability 2/7, and each other number (1-5) with probability 1/7. If Alice learns that the die is loaded in this way, only has this die, and must generate 20 fair/unbiased ...
Consider two schemes both have computation complexity linear to the input size (i.e. number of inputs). One scheme is based on Paillier encryption and the other one is based on fully homomorphic encryption. Question 1: In general, can we compare their performance (i.e. which one is faster)? Question 2: In general, can...
CPA attack means the attacker can send in his own plaintext to the oracle and receives some sort of ciphertext back. CCA attack means the attacker can send in his own ciphertext to the oracle and return some sort of plaintext back. When we talk about CPA and CCA secure, what exactly are we referring? All this time I ju...
I am trying to understand how to calculate the average key search time given a specific scenario: Suppose we have a program that uses standard DES with 56 key bits, and we can test 10^6 keys per second. The key consists of 8 characters, a simple concatenation of the 8 ASCII characters yielding 64 = 8*8 key bits. With ...
I have some encoded strings which are probably encoded in a base64-variant - except that there aren't only 64 chars, but all the (printable) ASCII chars between 33 and 126 (0x21 to 0x7E). I've searched for other base64-variants but only found variants like base85 which excludes some characters that may cause problems....
I've been reading up on probabilistic polynomial-time algorithms and one-way functions, and I was hoping to get some guidance on the topic. A textbook I'm reading states the following for one of the conditions for one-way functions: Hard to invert: For every probabilistic polynomial-time inverting algorithm A, there ex...
I'm currently studying for a cryptography exam. I've been given ciphertext that has been encrypted by a columnar transposition cipher. I've been given no shift key length or key word, the only thing I know is that only 2 columns have been shifted. How can I determine the key? Or better yet, is there another way to deci...
I have seen numerous references on the internet of people describing SHA-256 as generating an "almost unique" hash. Exhibit A. there are more. Is there some mathematical basis to the almost uniqueness? I would have thought that as SHA-256 is an evenly-distibuted (?) hash algorithm which can accept any message (infinite...
I have a question . How the system know the attributes of the users to be after that as a public key in ABE?
So I have been reading and learning a lot about cryptography lately and in particular asymmetric ciphers such as RSA. One thing that I am curious about but never seems to be mentioned is how the cipher algorithm manages to compute such enormous numbers in reasonable amounts of time. This example shows what I mean. Such...
In Gentry's paper on fully homomorphic encryption using ideal lattices, he finds the values of vectors modulo a certain basis. For instance: $\psi \leftarrow \psi' \mod B$ Taken from page 69 of Gentry's thesis. What does it mean to evaluate a vector modulo a basis?
I'm having a lot of trouble trying to understand how to implement AES-GCM. My usecase: Person A sent me a file with a gauranteed unique name. I want to be assured it was from person A, and that no one saw the contents, and that it wasn't tampered with. I figured that I would do the following: Person A would give me a...
For a college programming assignment I have to implement a secure communication protocol between a server and one or more clients. Upon instantiation of the server program, a file is generated, call it 'server_file'. This is then placed in a known location and assumed to be made available to the client program(s) via a...
Looking in some cryptographic algorithms, I've realized that: The way the plain text is encrypted/decrypted is always specified, but what about the key? Every paper I've seen describing the algorithm never show a way to generate a key, but show the available key sizes. This leads me to a question: How should I generate...
There are many examples of MD5 collisions (some of them can be found here Are there two known strings which have the same MD5 hash value?). But as far as I know two inputs should have the same length to have the same MD5 (or same hash in general). Is it correct? Is there any proof of that? Or otherwise examples of inpu...
I am trying to understand how the linear complexity profile of an LFSR is calculated. For example, I have the bit sequence $110101$ and its profile $1 1 2 2 3 3$. Is there any easy way to produce the profile?
Lets say that $f:\{0,1\}^* \to \{0,1\}^*$ is a strong one way function. Let $h(x)=f(x)||x_n$ where $x_n$ is the $n$th bit of $x$. I understand that $h$ will not be a strong one-way function. However, I wish to gain an intuitive understanding why that is.
Currently, the code I am staring at uses the CKM_EXTRACT_KEY_FROM_KEY mechanism. That has been disabled in our hardware module, so I need a different mechanism to derive a new key from an existing aes key. I don't want to change too much code as I don't know what the ramifications will be. I could use C_CopyObject, ...
I'm looking at an implementation of SRP (Secure Remote Password) that essentially follows the Stanford documentation (http://srp.stanford.edu/design.html). I'm worried about one aspect though: In the initial message exchange the server sends the parameters to be used (modulus $N$, generator $g$, salt $s$) to the client...
I'm trying to test the ring signature scheme proposed by Rivest Shamir and Tauman in the famous paper "How to leak a secret". One of the step consist in 4) the signer solves the following ring equation for y1: Ck,v(y1,y2,y3)=v" I have everything except $y_1$. It's defined that $C_k,v(y_1,y_2,y_3) = E_k(y_1 \oplus E...
I spent all day trying to figure ring signature schemes out but apparently I wasted time. I read the original ring signature paper (Rivest's How to leak a secret). I'm having numerous problems. Let's just say that a nice and simple example would make everything clear. I'm talking about something like this example for R...
I'm designing a key distribution mechanism and have thought of using a securely generated/acquired private key as a seed for a sequence of private keys to be distributed to a number of users using a key encryption key which is exchanged through a secure channel during the initialization step. The setting is as follows...
So I'm reading this question to learn more about length extension attack, and I want to make sure I understand the basics of padding. It says in the post that given the hash and the length of the message, I can easily compute the padding. Now, from what I understand, each block will always be 512 bits, or 64 bytes. So ...
Generally if the body is hashed, why provide the body and the hash as input into the HMAC. Instead wouldn't the same security be achieved by hashing the body and providing only the hash as input into the HMAC? I looked at the documentation here. I also looked at the answer here which provides detailed description of w...
For example, Square reader uses hardware encryptions when swiping credit cards. Is it possible to know the key that is used by the hardware encryption cipher by analysing the hardware circuitries? The key has to be somewhere in the hardware, right?
In their work on SHA-1 collisions (cf. the EUROCRYPT-2016 paper “Freestart collision on full SHA-1” by Stevens, Karpman, and Peyrin) Stevens et al show that they are able to generate "freestart collisions" on SHA-1. They say: Even though freestart collisions do not directly lead to actual collisions for SHA-1, in our ...