instruction
stringlengths
33
27.2k
RFC 4880 may be full of information, but it can be incredibly vague at times, so im looking for someone who actually knows the answer to this. Given this public key: -----BEGIN PGP PUBLIC KEY BLOCK----- Version: BCPG v1.39 mQGiBE5B0h8RBAD533Z5bK1IpBx02QyQL0QoJE4uFRIMGDiwXuwmZzVl+R7Vlurd GRLsCCbE6vOOh7XQVZGzLEBy9WNzZ9m...
Is it possible to secure a communications channel against both passive (sniffing) and active (injecting / MitM) attackers without either legitimate party knowing any pre-shared information? I know that this isn't possible using "traditional" asymmetric crypto, since an active attacker could create its own public keys a...
In implementing a cipher in GCM or CCM mode, you are provided the option to add "Additional Authenticated Data" (AAD). This AAD is required for decrypting the cipher text, and seems to be used when data is crucially specific to a label. EDIT: to clarify, an example of when it might be used that I have seen is if you wa...
Imagine that we're trying to create a function to generate a random string conforming to a user-supplied alphabet. That way, users can generate random strings with given characters. Something like: string random_string(int length, string alphabet) Now, the alphabet could be any combination of characters from length 2 ...
MACs differ from digital signatures in the sense that MAC values are both generated and verified using a shares secret key. Does this in any way put MAC on a disadvantage as compared to digital signatures? How is one of them better than the other?
GnuPG has slow hash built-in in form of iterated+salted S2K. Does it have disadvantages in comparison with bcrypt or scrypt? Is GnuPG's slow hash method easily automated in GPUs?
Can anyone suggest a good (CS)PRNG algorithm that takes advantage of having a very large (ideally arbitrarily large) seed? I'd like to use several kilobytes, perhaps several hundred kilobytes, of random data to generate up to a few dozen megabytes of PRNG output. The PRNG algorithms I'm aware of only take relatively sm...
As per title, other than brute force, are there any attacks on Threefish-512 using only a single plaintext block? Are there any attacks like this in any other cipher?
Are there any security risks using a single key-pair for both key-exchange and signing? I'm mainly interested in using Curve25519 for key-exchange and Ed25519 for signing. But similar combinations, such as EC-DH and EC-Schnorr or even EC-DSA with the same key pair would be interesting too. Curve25519 hashes the output...
The classic multiparty computation protocols are defined around " Untrusted parties trying to compute something together". But is there a cryptographic abstraction for, "Trusted parties trying to compute together in presence of untrusted server"? Basically, I am looking for something like multi-player homomorphic enc...
Are there any papers, books, or link where it explains how the plain vanilla "textbook RSA" is actually implemented in practice with all the padding and stuff? Basically, I would like to know the intricacies of implementing an algorithm into production level code…
I would like to know how to extract contents of the password protected WinRar file without the password. I have downloaded that WinRar file from a file hosting website and found out that it was password protected after I downloaded it. I would like to know is there any way to “unprotect” a password protected file so I ...
Consider the generation of an RSA key pair with a given modulus size $n$ and a known, small public exponent $e$ (typically $e = 3$ or $e = 65537$). A common method is to generate two random primes numbers of size $n/2$ (or very close), and check at least that they are probable primes and that $\mathrm{gcd}(e, (p-1)(q-1...
How secure is libgcrypt's Elgamal implementation of encryption (how different it is from textbook Elgamal), and how can I tweak padding and other preprocessing actions? For example, I know that usign RSA I can use this S-expression to the function gcry_pk_encrypt: (data (flags pkcs1) (value BLOCK)) And I can use o...
Most modern algorithms require relatively large amount of resources. Is there any recent (and freely usable) encryption/decryption algorithm which is specially designed for low-level microcontrollers in mind? This means it has to run fast, (on a very simple, 8 or 16 bit, 10-20 MHz processor), be small (few hundred byte...
Is there difference between Algebraic Homomorphic Encryption and Fully Homomorphic Encryption Schemes?
As sort of a follow up to my (currently) unanswered question, if it is correct, how do i properly calculate and format the packet that actually stores the data being encrypted? I thought I knew what I was doing, but something here causes bouncycastle to freak out. Using data from the first post and: AES256 (pgp value 9...
Is there any relation between secure multiparty computation and threshold cryptosystem ?
I realize this is mixing the purposes between asymmetric and symmetric crypto, but I was wondering if it is safe to use a hashed, truncated private key (asymmetric) as the symmetric key for encrypting data at rest? For this question I am presuming RSA is a 1024 bit key, SHA1 produces 160 bits, and AES is using a 128 b...
I have several questions concerning the original Paillier cryptosystem as described in Paillier, Pascal (1999). "Public-Key Cryptosystems Based on Composite Degree Residuosity Classes". EUROCRYPT. Springer. pp. 223-238. DOI: 10.1007/3-540-48910-X_16 Notation: $p$ - unencrypted message, plaintext $c$ - encrypted message...
I have a PDF document intended for long-term (many years, maybe decades) archival which I would like to digitally sign with my personal certificate to ensure its integrity. As far as I understand, I need to timestamp the signature in order to ensure it remains valid even after certificate expiration. Let's say I use a ...
I've been looking at the off-the-record messaging protocol, and there is something about its deniability property that seems strange to me. Consider the following scenario: In the course of an OTR conversation, Alice decides to break Bob's deniability, e.g. she wants to be able to prove to some third party that Bob ...
I agree that for certain encryption systems or modes of operation, a MAC is indispensible. The best example are probably stream ciphers (and therefore also block ciphers in OFB or CTR mode) that allow an attacker to arbitrarily flip bits in the ciphertext, resulting in flipped bits at the same position in the plaintext...
A "normal", brute-force attack on a cryptographic hashing algorithm $H$ should have a complexity of about $2^{n}$ for a hash algorithm with an output length of $n$ bits. That means it takes about $2^{n-1}$ tries on average to find a colliding message $y$ for a given message $x$ so that $H(y) = H(x)$ while $y \ne x$. Ho...
Many AES-encrypted things (files, strings, database entries, etc.) start with "Salted__" ("U2FsdGVkX1" in base64). I hear it's some sort of OpenSSL interoperability thing: a b c. Is there some standard reference somewhere (perhaps an RFC?) that explains how such OpenSSL-inter-operable AES-encrypted things are produced ...
I'm currently using SSL with AES-CBC and HMAC for a file transfer containing string M. Now suppose Alice already knows SHA1(M) (and the adversary does not), and she downloads M from Bob using only AES-CBC without a MAC. Normally this would be ill-advised, but since she can check SHA1(M) after the download completes, i...
I am redesigning a password reset email mechanism because the existing implementation scares the hell out of me. My goal is to generate reset codes that are: Expired Tamper Resistant Single Use Resistant to replay attacks The format of the reset code I have come up with is: B64( B64( iv ) || B64( E( uid || timestamp ...
Let's say I'm a lazy user of a system with annoyingly frequent password change policies. I may have a "good" password I used initially that is only used for this system but since I have to change it every week I'm just going to increment or decrement a number. E.g. Week 1: 545h9yEQ8k37t!VW53d7g6263!&D4grz Week 2: 645h9...
Consider this algorithm: def ksa(k): L = length(k) j = 0 for i from 0 to L: #[0..L-1] (non inclusive "to") j = (j + k[k[i] % L])%L swap(k[i], k[j]) k is an array of integers $0 \leq x < 256$. The questions is how to enumerate all possible arrays k resulting in an array with given pr...
I'm trying to implement a modified version of the ElGamal cryptosystem as specified by Cramer et al. in "A secure and optimally efficient multi-authority election scheme", which possesses additive homomorphism between ciphertexts, as opposed to the original version, which presents multiplicative homomorphism. The BIG p...
Sorry if this question's a bit basic, but I don't know of any way to ask it concisely enough for a search... What I'm looking for is a proven means of doing the following: Create x number of strings so that any combination of at least y of those x can be used to recreate a message. For example: if I have "this is my ...
I need to generate a 256 bit encryption key described by the adjectives in the title. Currently I intend to create the key using this RNG. Is this a secure manner of creating the key, given that it has the following properties: Private key for symmetric encryption Used many times (of course with unique IV's) And give...
Let (E,D) be a secure block cipher. Consider the following tweakable block cipher: E'(k,t,x) = E( (k+t) mod |K|, x) D'(k,t,c) = D( (k+t) mod |K|, c) Is (E',D') secure?
I was wondering about making up a simple system to encrypt a file: seed the random number generator with the passcode generate as many random bits as the file has xor This has a vulnerability that if you encrypt two file A and B with the same passcode, xoring the two encrypted files would give the xor of A and B... so...
Consider the Miyaguchi–Preneel construction: $H_0 = E(0,m_0) \oplus m_0$ (0 here means a vector filled with zeros) $H_1 = E(H_0,m_1) \oplus H_0 \oplus m_1$ where $E(K,M)$ is a block cipher (for example AES), $m_0, m_1$ are messages. What's the best way to find messages $m_0$, $m_1$, such that $H_1$ will have a given ...
Yesteryears problems of communication privacy has been well defined in cryptography through Asymmetric cryptography. Due to rise in Cloud computational model , computational heavy tasks are being outsourced to a remote server for economic reasons, and there is need for computational privacy . Is there any crypto forma...
Is it good to use a mouse movement as a 64-bit random seed for a Pseudorandom Generator like AES in Counter Mode? Should I only need to get the X and Y coordinates of the mouse movement?
From what I know, the HMAC constructions has two strength: It's resistant to length extensions Since the key is consumed before the message, the attacker does not know the initial state, preventing simple collision attacks. But the simple construction $ \mathrm{Hash}(\mathrm{Hash}(\mathrm{key} ∥ \mathrm{message})) $ ...
If an adaptive hash function like bcrypt or PBKDF2 is used in hashing passwords, the number of iterations used in the hashing process can be configured. For a penetration tester or a malicious hacker, what are the ways to determine how many iterations were used in hashing passwords, assuming that they do not have acces...
I understand that hashing a datetime is a pseudo-random number, and not good in a security context. But what about hashing a datetime plus a truly-random but constant string (just a string that an "attacker" could not possibly guess)? This is not a question for a practical implementation, just a theoretical question. I...
I've written encryption/decryption routines using AES GCM. Code can be found here. I recently realized that the cipher text is longer than I believe it should be. It should add the tag and IV onto the encrypted plaintext, but the result is still longer than it should be. Here is the portion of the code doing the encry...
MD5 is a very fast hash and its output is short and easy to store. Should I use it for my non-security-sensitive application? I don't think so, but I can't seem to convince anyone else that this is true.
I can understand that ROT13 is not secure for obvious reasons, but I'm looking for the theoretical answer. Wikipedia says "The algorithm provides no cryptographic security.." What does it mean to provide cryptographic security? Why does it provide no security as opposed to, say, very little security? What would make ...
I want to calcuate the CRC32 algorithm using polynomials directly but I don't know how. I found the generating polynomial listed here https://en.wikipedia.org/wiki/Cyclic_redundancy_check. This corresponds to 0xedb88320 in the example code. Can someone please define a mathematical specification that calculates the same...
I have a file that is encrypted in AES using a 16 char string. The string is (a-zA-Z0-9) and .,?!. Also, it only contains words from a dictionary (but they can be lower/upper case). What would be the most effective way to brute force this? (No, I'm not trying to brute force passwords. Who would store passwords in AES…)...
Are there any multiparty homomorphic encryption schemes ? Most of the literature is about two party schemes . Is there any generalization made for n party ?
There is a communication protocol that I believe creates the equivalent of a one time pad, with the downside that the secret message must be transferred multiple times. The protocol is so simple that I imagine that it has a name but I can't find a protocol which matches its description. Assumptions: A client C wants ...
Lets say that we use init vector IV, key K and HMAC key H. Message is M. Mode of operation is CBC !!! We usually encrypt this way: C = crypt(M,K,IV) #encrypted data R = C + MAC(C) # final result and + is for con cat But we could just use: R = len + crypt(M + H,K, IV) # notice M + H Is there something wrong wi...
So with the recent news that there's a lovely new tool to crack MSChapV2 packets. So the question I have is on a SSTP Connection is the MSChapv2 handshake encrypted pre SSL setup or post. Obviously if it was pre then packets could be stolen, if it was post then thats at least an additional layer of security. I did po...
I have limited exposure to cryptographic terminology, so please bear with me. My end goal is to encrypt integer IDs, before transmitting them to a web client in a list of search results, in a way that prevents enumerating IDs. Only the transmitting authority should be able to decrypt them. The client will select a sing...
I'm using a 64-bit nonce (incremented between the streams) and a 64-bit counter (incremented within a stream) for AES in CTR mode. How many different key streams can I produce with this setup?
In .NET Framework, there is a cryptographic Random Number Generator (RNG) provider which enables to generate a cryptographically strong sequence of random bytes. This provider contain, among others, two methods: GetBytes which generates a sequence of random bytes, and GetNonZeroBytes which does the same thing, except ...
Consider the following code and output: public static void Main() { DESCryptoServiceProvider symAlg = new DESCryptoServiceProvider(); symAlg.BlockSize = 64; symAlg.GenerateKey(); symAlg.Mode = CipherMode.ECB; testCipher(symAlg, new byte[] { 0x01, 0x02, 0x03, 0x04...
Are there any practical implementations and or software platforms to prototype applications based on MPC ?
According to many sources, the first few (n) bytes of the RC4 keystream are strongly biased, and therefore should be discarded before using the keystream to encrypt anything; this precaution is commonly called RC4-drop-n. There are variants of RC4 available in SSH that do exactly that (arcfour128 and arcfour256). I've ...
Within a closed computer network, I am ciphering some plaintext data as an added security measure. This is below several other layers of protection. For various technical reasons, I am restricted to plain-text, UTF-8 data. To that end, I have been using a Vigenère cipher with pre-shared key database. The keys range fro...
Considering a stream cipher that produces a ciphertext $c$ from a message $m$ and a key $k$ is it possible to apply operations (multiplication and/or addition) directly to $c$ without knowing the key ? Example : $m$ > encrypt > $c$ > $c+5$ > decrypt > $m+5$ I can not manage to get a valid $m$ at the end. I tried to wor...
In the Secure Remote Password Protocol, the verifier must be stored on the server. In the case of a server compromise, an attacker could obtain these verifiers. If nobody reused passwords, this wouldn't be a big deal (as the users' data is probably also compromised). However since people do reuse passwords it seems ...
When using a "good", modern cipher (specifically one that provides ciphertext indistinguishability), is it a problem at all if there is some well-known structure in all plaintexts? For example, consider a simple protocol that transmits many messages that all start with an identical, but secret string. All of the messag...
I have a two set of key {36,77} and {50,117}, How can validate if it is a valid RSA public keys? Is there any simple method?
I am trying to implement MISTY1. It's RFC, RFC2994, contains psuedocode that I basically copy and pasted into Code::Blocks. However, I managed to mess that up somehow. After 2 days, I still have not figured out what i did wrong (Im probably being blinded by familiarity). The RFC provides 2 test vectors, but only the ke...
What's the practical status of MD5 w.r.t. second-preimage? Integrity of a piece of data is protected by an MD5 hash, itself assumed genuine. The data (and thus the hash) is known to the adversary. The adversary can change the data, and wants to do that while leaving the hash identical. Denote the data size as $K$, in 5...
Can someone explain to me the relevance of the static matrix used for the mixcolumns operation in aes encryption.i.e the relevance of why the byte is multiplied by 2 + next byte multiplied by 3 + next byte +next byte
Suppose I am storing a number of encrypted documents in a database. I would like to make it possible to identify the subset of documents whose contents match user-specified search terms without a) maintaining a plaintext index or b) decrypting documents on the fly. Is there any way to accomplish this securely? By the s...
Considering a symmetric cipher (i.e : AES in counter mode), is it possible for any given key to be randomly decomposed into other keys without knowing the message or the ciphertext, such as : 100 = 45+55 (or) 30+70 (or) 25*4 (or)... Key1 = Key2|Key3 (or) Key4|Key5 (or)... For any message, applying Key1 or Key2|Key3 w...
This is a follow-up question to Does TLS use RC4-drop[n]?. As mentioned in section 6 of RFC4345, there are weak distinguishers for RC4 keystreams available that even work for keystreams that originate from different keys, and regardless of the distance from the start of the keystream. Doesn't that make an attack on sch...
Following on from D.W.'s comments on a previous question, what properties does Blum Blum Shub have that make it better / worse than other PRNGs? Are there significant implementation difficulties or security issues with BBS?
Can we use a polynomial $P(x)$ to securely communicate ? For example Alice & Bob agree on a degree of a polynomial. The value $x$ & the coeficients are generated from a seed using a hash function or any other PRG and change in each communication, the plaintext $m$ is hidden into $P(x)$. For example $P(x) = ax^2+b(m)x+...
According to the specification of RFC 4764, contents in EAP's third message and fourth message are required to be encrypted by AES-128 in EAX mode (also called protected channel). In RFC 4764, the length of ciphertext is as the same as the length of plaintext. However, the test vectors in The EAX Mode of Operation show...
I was playing around with a problem in e-voting schemes that use additive homomorphic encryption to tally votes, namely that at the end of the day somebody (or somebodies, if the secret material has been broken up somehow) has to be trusted to decrypt the final tally. Looking at ElGamal's additive variant, reproduced h...
How long does it take to extract a key from a FIPS-140 Level 2 device? What records are there of successful extraction? How much did the first extraction from a given device cost? How much would a subsequent extraction cost? Dr. Google is usually very helpful on questions like this but he isn't helping me here. An...
Alright Ive been working on this one for a while I found φ(60131) to be 97294 ½(60131+60131(5)^.5) = 97294 then I worked through the GCD GCD(985,97294) = 1 97294 = 985*98+764 985=764*1+221 764 = 221*3+101 221 = 101*2+19 101=19*5+6 19= 6*3+1 6 = 1*6 GCD = 1 Now Im stuck trying to find the inverse of 985 mod φ(601...
I recently read the article Nonce-Based Symmetric Encryption by Rogaway, where he presents two different notions of indistinguishability, which he calls ind$ and ind, respectively. Here's the definitions of these to notions: First, let $A^g$ be an algorithm with access to an oracle $g$, and let $\Pi = (\mathcal{E},\mat...
I have one question about the ECDSA signature scheme. When Bob wants to send a message to Alice that is to be signed she makes following things (with for example $A = (5,1)$, $d=7$, $q=19$). compute hash of message $h(x) =26$ choose ephemeral key $k_E = 10$ $R = k_E · A = 10 · (5,1) = (7,11)$ $r = x_R = 7$ $s = (h(x)+...
I want to implement an internet-based e-voting system. Voters shall be able to cast their vote for one out of n possible candidates. Each candidate has his own ballot-box kept by and at a trustworthy third party. This third party is absolutely trustworthy insofar as it can be trusted to attend to his duties of supervis...
I'm developing application in Java that has to store RSA keys in software for foreseeable future (that is, at least 10 years). The two most common standards of storing private keys are PKCS12 and JKS (Java Key Store). While PKCS12 supports many different algorithms, even the most secure ones are based on 3DES with SHA1...
I want to ask some questions about the PBKDF2 function and generally about the password-based derivation functions. Actually we use the derivation function together with the salt to provide resistance against the dictionary attacks, right? One example is the UNIX encryption scheme. My first question:For example, if wan...
Oplop is an algorithm that generates account-specific passwords from a master password and user-chosen nickname (typically username@domain). From the website: Concatenate the master password with the nickname (in that order!). Generate the MD5 hash of the concatenated string. Convert the MD5 hash to URL-safe Base64. S...
As I understand it, the main advantage of bcrypt is stretching so it becomes slower to crack overtime. But, is using a "good enough" algorithm (e.g., SHA-2 family) then stretching until it's slow enough for your liking is pretty much the same as bcrypt? Note: I understand scrypt is superior but let's assume bcrypt is t...
I'm working on a messaging service that lets users author messages and have them signed with an RSA key. The key is used for identity purposes only and can be revoked, so compromising the private key is annoying, but does not expose proprietary information. Still, in order for a service to sign on behalf of a user, tha...
I need a GUID. Really just any number that is likely to be unique. However I prefer not to leak time and other things as a GUID may leak. What should i use as a cryptographic replacement? I was thinking maybe i could use PBKDF2 using a GUID + salt/pepper but maybe thats overkill or not what i want?
I heard multiple times not to reuse the same IV and IV should be random but doesn't need to be secret. I also heard if the IV is something like sequential numbers or something predictable I should hash(salt+pepper) it. Why on earth should i be doing that if they don't need to be a secret? In this specific case i am enc...
Recently I found out that in the modes CBC and PCBC the IV may be passed in cleartext but never must be predictable. However for this part of my app I rather have the IV be predictable and unique (i.e. generated from other data known to the "receiver" and also the adversary, and not stored/transmitted with the cipherte...
Is it the same as the bits of the key (So a 2048 bit system will yield a 2048 bit signature)? At most as the key? Or something else entirely?
I've been reading up on the Secure Remote Pasword protocol (SRP). There are a couple different versions of the protocol (the original published version being designated SRP-3, with two subsequent enhancements 6 and 6a). There was a very limited attack on version 3, where the attacker could submit two password guesses p...
I read that Fully Homomorphic Encryption schemes are special case of Secure MPC in page no 3. Especially , generalization of two party computation problems stated by Yao But is there any additional literature showing the connections of the same ?
While writing this answer, I noted that NIST SP 800-38A says that (emphasis mine): "For the CBC and CFB modes, the IVs must be unpredictable. In particular, for any given plaintext, it must not be possible to predict the IV that will be associated to the plaintext in advance of the generation of the IV." For CBC mode...
Is the MD5 prefixing attack still valuable to an attacker if he doesn't know the postfix of the string? For instance, what if the following sanity check was being used: if attacker_controlled_sanity_code == md5(attacker_controlled + secret_key) Clearly not an RFC compliant HMAC. Despite the fact that the attacker...
Are the terms AES CCM and AES CCMP are equivalent, or is there any technical differences between the two?
Consider a communication channel that needs to be secure (Encryption can not use full "volume" encryption, since future messages are not known). Would it be better to only transmit encrypted messages and remain silent the rest of the time (therefore letting eavesdroppers know when a message is passed), or sending encr...
Does a certificate contain the complete chain of all certificates up to the trusted root certificate, or does the program that verifies certificates have to fetch each parent certificate individually in the chain to reach a trusted root certificate?
I have a function f(x,n) that takes a 128-bit key x, and generates n bytes of pseudo-random data. I've tested the output bytes this function for various keys with the NIST RNG testing suite (NIST Special Publication 800-22 A Statistical Test Suite for Random and Pseudorandom Number Generators for Cryptographic Applicat...
Suppose you're connected to a VPN server via an SSTP VPN, and then you're trying to sign in to your webmail account that is already secured with an SSL certificate, e.g. hushmail.com. However, it seems your original data traffic is double-encrypted by both SSTP & SSL. Now suppose that for any reason your SSTP connectio...
In an abstract sense, aren't both the same? Don't their definitions boil down to the following? security through obscurity: trying to make sure some information cannot be obtained without knowing the secret method encryption: trying to make sure some information cannot be obtained without knowing the secret key That ...
This is an exam question an i have no idea how to recover the message m. John wants to send an encrypted message to mary who has a pair of RSA keys, However, John does not know Mary's public key and so John sends an email to Mary to ask for the key. mary's email reply is intercepted by Peter who replaces Mary's public...
Hopefully, Crypto can help me understand homomorphic cryptosystems. I'm designing a high score server for a game I made, and because of facets in the language I'm using, the player would be able to look through the code and execute functions in my game. So, I'm trying to encrypt the score when it is sent to the server...
I understand that for example MD5 produces a 128 bit hash value from a given text of variable size. My question is if there is a hash-like algorithm that will produce a hash value where one can specify the length of the outcome? So one would specify that that given any input the hash value (output) should be say 1000 b...
I am trying to find some measurement for identifying and distinguishing between compressed and random data. I tried this first by computing the entropy of such data, the entropy value is extremely high (almost maximum) in both cases, so that way does not seem to work as a distinguisher. I read about the chi square algo...
It is a great idea if experts in Cryptography from mathematicians to security engineers introduce books and textbooks which they think is helpful or instructive for all people interested in the field.I didn't find such topic in previous posts. I think a good format for answering would be like this: I. Theory, An...
I want to store files (images) on a public webserver and let users see them if they know a password. The server shouldn't have the unecrypted files and the server can only serve files, not perform any server-size computation. One thing that I know about crypto is that I know very little so I'd like a review of the fol...