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
104
votes
1 answer

Best practices around generating OAuth tokens?

I realize that the OAuth spec doesn't specify anything about the origin of the ConsumerKey, ConsumerSecret, AccessToken, RequestToken, TokenSecret, or Verifier code, but I'm curious if there are any best practices for creating significantly secure…
mckamey
  • 17,359
  • 16
  • 83
  • 116
101
votes
10 answers

How to encrypt data that needs to be decrypted in node.js?

We are using bcrypt for hashing passwords and data that never needs to be decrypted. What should we do to protect other user information that does need to be decrypted? For example, let's say that we didn't want a user's real name to be in plain…
fancy
  • 48,619
  • 62
  • 153
  • 231
100
votes
11 answers

Protecting Java Source Code From Being Accessed

Last week, I had to create a little GUI for homework. None of my school mates did it. They have stolen my one from where we had to upload it and then they uploaded it again as theirs. When I told my teacher it was all my work he did not believe…
LoremIpsum
  • 505
  • 4
  • 8
  • 20
97
votes
5 answers

AES Encryption - Key versus IV

The application I am working on lets the user encrypt files. The files could be of any format (spreadsheet, document, presentation, etc.). For the specified input file, I create two output files - an encrypted data file and a key file. You need both…
Peter
  • 11,260
  • 14
  • 78
  • 155
97
votes
11 answers

Obfuscating an ID

I'm looking for a way to encrypt/obfuscate an integer ID into another integer. More precisely, I need a function int F(int x), so that x<->F(x) is one-to-one correspondence (if x != y, F(x) != F(y)) given F(x), it's easy to find out x - so F is not…
georg
  • 211,518
  • 52
  • 313
  • 390
96
votes
4 answers

7-Zip command to create and extract a password-protected ZIP file on Windows?

On Mac/Linux to zip/unzip password protected zip files, I use: Zip: zip -P password -r encrypted.zip folderIWantToZip Unzip: unzip -P password encrypted.zip What are the equivalent command on Windows on the command line (assuming that 7zip has…
user3254893
  • 1,071
  • 2
  • 13
  • 14
92
votes
4 answers

How to decrypt an encrypted Apple iTunes iPhone backup?

I've been asked by a number of unfortunate iPhone users to help them restore data from their iTunes backups. This is easy when they are unencrypted, but not when they are encrypted, whether or not the password is known. As such, I'm trying to figure…
Aidan Fitzpatrick
  • 1,950
  • 1
  • 21
  • 26
91
votes
5 answers

What are best practices for using AES encryption in Android?

Why I ask this question: I know there have been a lot of questions about AES encryption, even for Android. And there are lots of code snippets if you search the Web. But on every single page, in every Stack Overflow question, I find another…
caw
  • 30,999
  • 61
  • 181
  • 291
91
votes
8 answers

How to resolve the "EVP_DecryptFInal_ex: bad decrypt" during file decryption

I have the following query.Could any one please suggest me a solution. I'm working on encryption and decryption of file for first time. I have encrypted file through command prompt using the command: openssl enc -aes-256-cbc -in file.txt -out…
Sai
  • 931
  • 1
  • 7
  • 6
88
votes
13 answers

Why is XOR used in cryptography?

Why is only XOR used in cryptographic algorithms, and other logic gates like OR, AND, and NOR are not used?
Bhaskar
  • 10,537
  • 6
  • 53
  • 64
87
votes
8 answers

Method not found using DigestUtils in Android

I am trying to use the library DigestUtils in Android 2.3.1 using JDK 1.6, however I get the following error when executing the app: Could not find method org.apache.commons.codec.binary.Hex.encodeHexString, referenced from method…
Caumons
  • 9,341
  • 14
  • 68
  • 82
82
votes
6 answers

Ansible: How to encrypt some variables in an inventory file in a separate vault file?

The settings Consider an Ansible inventory file similar to the following example: [san_diego] host1 host2 [san_francisco] host3 host4 [west_coast] san_diego san_francisco [west_coast:vars] db_server=foo.example.com db_host=5432 db_password=top…
Adam Matan
  • 128,757
  • 147
  • 397
  • 562
82
votes
6 answers

Android database encryption

Android uses SQLite database to store data, I need to encrypt the SQLite database, how can this be done? I understand that application data is private. However I need to explictly encrypt the SQLite database that my app is using.
user121196
  • 30,032
  • 57
  • 148
  • 198
81
votes
1 answer

what is the difference between various keys in public key encryption

I am confused between various keys used in encryption. Amazon gave me key.pem In linux i generate keys like id_rsa and id_rsa.pub Now putty used key like key.ppk I am really confused what type of key is used where
user22
  • 1,199
  • 2
  • 12
  • 15
79
votes
9 answers

Size of data after AES/CBC and AES/ECB encryption

I would like to know the size of data after AES encryption so that I can avoid buffering my post-AES data(on disk or memory) mainly for knowing the size. I use 128 bit AES and javax.crypto.Cipher and javax.crypto.CipherInputStream for encryption. A…
Ramson Tutte
  • 843
  • 1
  • 7
  • 8