Questions tagged [encryption]

Encryption is the process of transforming information (called plaintext) into an unreadable form (called ciphertext) using an encryption algorithm using a secondary parameter (called an encryption key). Only those who possess the decryption key can easily reverse the process and recover the original plaintext. Conceptual questions about encryption may get better answers on crypto.stackexchange.com.

In cryptography, encryption is the process of transforming information (called plaintext) into an unreadable form (called ciphertext) using an encryption algorithm combined with a parameter called an encryption key. Reversing the process, that is transforming the ciphertext into plaintext, is called decryption. Only those who possess the decryption key can reverse the process and recover the original plaintext.

There are 2 types of encryption methods generally:

  • symmetric
  • asymmetric

In symmetric encryption the encryption and decryption keys are the one and the same; this single key is sometimes called the shared secret key. Rijndael(AES), TwoFish, and Cha-Cha are examples of symmetric encryption algorithms.

In asymmetric encryption, also known as public key encryption, the encryption and decryption keys are different. The encryption key is called the public key and the decryption key is called the private key. RSA, Diffie-Hellman (DH), El-Gamal (ElG), and elliptic curve variants of DH and ElG are examples of public key encryption algorithms.

The term "encryption" should be reserved for transformations intended to be reversed or "decrypted". In particular, cryptographic transformations intended to be one way, such as cryptographic hash algorithms (e.g. SHA1, SHA2, SHA3) and password hashing algorithms (e.g. bcrypt, scrypt) should not be referred to as "encryption".

Encryption has long been used by militaries and governments to facilitate secret communication. Encryption is now commonly used in protecting information within many kinds of civilian systems. It can be used to protect data "at rest", such as files on computers and storage devices (e.g. USB flash drives). In recent years there have been numerous reports of confidential data such as customers' personal records being exposed through loss or theft of laptops or backup drives. Encrypting such files at rest helps protect them should physical security measures fail. Digital rights management systems which prevent unauthorized use or reproduction of copyrighted material and protect software against reverse engineering (see also copy protection) are another somewhat different example of using encryption on data at rest.

Encryption is also used to protect data in transit, for example data being transferred via networks (e.g. the Internet, e-commerce), mobile telephones, wireless microphones, wireless intercom systems, Bluetooth devices and bank automatic teller machines. There have been numerous reports of data in transit being intercepted in recent years. Encrypting data in transit also helps to secure it as it is often difficult to physically secure all access to networks.

Encryption, by itself, can protect the confidentiality of messages, but other techniques are still needed to protect the integrity and authenticity of a message; for example, verification of a message authentication code (MAC) or a digital signature. Standards and cryptographic software and hardware to perform encryption are widely available, but successfully using encryption to ensure security may be a challenging problem. A single slip-up in system design or execution can allow successful attacks. Sometimes an adversary can obtain unencrypted information without directly undoing the encryption. See, e.g., traffic analysis, TEMPEST, or Trojan horse.

One of the earliest public key encryption applications was called Pretty Good Privacy (PGP). It was written in 1991 by Phil Zimmermann and was purchased by Network Associates (now PGP Corporation) in 1997.

Source: Wikipedia.

See also:


Note: conceptual questions about encryption might get more attention and better answers from the Crypto stack exchange.

36876 questions
60
votes
5 answers

Securly Storing OpenID identifiers and OAuth tokens

I am creating a web app that will use OpenID logins and OAuth tokens with Youtube. I am currently storing the OpenID identity and OAuth token/token secret in plain text in the database. Is it inappropriate to store these values as plain text? I…
Matt McCormick
  • 13,041
  • 22
  • 75
  • 83
60
votes
7 answers

How to decrypt OpenSSL AES-encrypted files in Python?

OpenSSL provides a popular (but insecure – see below!) command line interface for AES encryption: openssl aes-256-cbc -salt -in filename -out filename.enc Python has support for AES in the shape of the PyCrypto package, but it only provides the…
Thijs van Dien
  • 6,516
  • 1
  • 29
  • 48
59
votes
6 answers

Encrypted and secure docker containers

We all know situations when you cannot go open source and freely distribute software - and I am in one of these situations. I have an app that consists of a number of binaries (compiled from C sources) and Python code that wraps it all into a…
Aleksei Petrenko
  • 6,698
  • 10
  • 53
  • 87
59
votes
1 answer

PEM_read_bio_PrivateKey() returns NULL in ECB mode only

PEM_read_bio_PrivateKey() returns NULL if a private key is encrypted by DES EDE in ECB mode. The issue happens in EVP_DecryptFinal_ex(): 4128:error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt:evp_enc.c:330: If the same private…
Alex
  • 2,361
  • 1
  • 20
  • 27
59
votes
3 answers

IsolateApps causes Decryption key specified has invalid hex characters

I working on a MVC 4 site which has uses Authentication. The site requires that I specify the Machine Key values. I did this via the IIS interface having deselected the "automatically generate at runtime", generated the key values and having…
WernerVA
  • 1,051
  • 1
  • 10
  • 16
59
votes
13 answers

What's wrong with XOR encryption?

I wrote a short C++ program to do XOR encryption on a file, which I may use for some personal files (if it gets cracked it's no big deal - I'm just protecting against casual viewers). Basically, I take an ASCII password and repeatedly XOR the…
Paul
  • 6,435
  • 4
  • 34
  • 45
59
votes
20 answers

java.io.IOException: Invalid Keystore format

Does anyone know how to solve this? I tried many things, but none of them worked. And when I click more details I get this: at sun.security.provider.JavaKeyStore.engineLoad(Unknown Source) atsun.security.provider.JavaKeyStore$JKS.engineLoad(Unknown…
Tomi
57
votes
13 answers

What encryption algorithm is best for encrypting cookies?

Since this question is rather popular, I thought it useful to give it an update. Let me emphasise the correct answer as given by AviD to this question: You should not store any data that needs encrypting in your cookie. Instead, store a good sized…
Jacco
  • 23,534
  • 17
  • 88
  • 105
56
votes
11 answers

Is it worth encrypting email addresses in the database?

I'm already using salted hashing to store passwords in my database, which means that I should be immune to rainbow table attacks. I had a thought, though: what if someone does get hold of my database? It contains the users' email addresses. I can't…
Roger Lipscombe
  • 89,048
  • 55
  • 235
  • 380
56
votes
3 answers

Encrypt, decrypt using Rails

I saw a while ago the possibility to decrypt and encrypt strings in rails without including any library, but I can't find the blog post. I want to be able to encrypt and decrypt strings without including anything. Using the same key has for the…
Linus Oleander
  • 17,746
  • 15
  • 69
  • 102
56
votes
1 answer

How are the IV and authentication tag handled for "AES/GCM/NoPadding"?

I'm using AES/GCM/NoPadding encryption in Java 8 and I'm wondering whether my code has a security flaw. My code seems to work, in that it encrypts and decrypts text, but a few details are unclear. My main question is this: Cipher cipher =…
Michael Hixson
  • 1,250
  • 1
  • 10
  • 15
56
votes
11 answers

Somebody is storing credit card data - how are they doing it?

Storing credit card information securely and legally is very difficult and should not be attempted. I have no intention of storing credit card data but I'm dying to figure out the following: My credit card info is being stored on a server some where…
leepowers
  • 37,828
  • 23
  • 98
  • 129
55
votes
7 answers

How do I compute the approximate entropy of a bit string?

Is there a standard way to do this? Googling -- "approximate entropy" bits -- uncovers multiple academic papers but I'd like to just find a chunk of pseudocode defining the approximate entropy for a given bit string of arbitrary length. (In case…
dreeves
  • 26,430
  • 45
  • 154
  • 229
54
votes
9 answers

How can I encrypt CoreData contents on an iPhone

I have some information I'd like to store statically encrypted on an iPhone application. I'm new to iPhone development, some I'm not terribly familiar with CoreData and how it integrates with the views. I have the data as JSON, though I can easily…
James A. Rosen
  • 64,193
  • 61
  • 179
  • 261
53
votes
4 answers

How to fix Invalid AES key length?

I am working on a text encryption and decryption project (following Struts 2) Whenever I enter the password and the plain text I get a Invalid AES Key Length error. The Service Class package com.anoncrypt.services; import java.security.Key; import…
Rishabh Upadhyay
  • 559
  • 1
  • 4
  • 7