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
44
votes
9 answers

How to do PGP in Python (generate keys, encrypt/decrypt)

I'm making a program in Python to be distributed to windows users via an installer. The program needs to be able to download a file every day encrypted with the user's public key and then decrypt it. So I need to find a Python library that will let…
Greg
  • 45,306
  • 89
  • 231
  • 297
43
votes
6 answers

"Padding is invalid and cannot be removed" using AesManaged

I'm trying to get simple encryption/decryption working with AesManaged, but I keep getting an exception when trying to close the decryption stream. The string here gets encrypted and decrypted correctly, and then I get the CryptographicException…
TimK
  • 7,438
  • 10
  • 40
  • 47
43
votes
6 answers

How do I add SSL to a .net application that uses httplistener - it will *not* be running on IIS

Most recent edits in bold I am using the .net HttpListener class, but I won't be running this application on IIS and am not using ASP.net. This web site describes what code to actually use to implement SSL with asp.net and this site describes how…
pc1oad1etter
  • 8,549
  • 10
  • 49
  • 64
43
votes
7 answers

RSA encryption and decryption in Python

I need help using RSA encryption and decryption in Python. I am creating a private/public key pair, encrypting a message with keys and writing message to a file. Then I am reading ciphertext from file and decrypting text using key. I am having…
user4866424
43
votes
13 answers

How can it be impossible to "decrypt" an MD5 hash?

Possible Duplicate: How come MD5 hash values are not reversible? I was reading a question about MD5, and it made me remember something that boggles me. Very simple question, and I'm sorry if it's not a good one. I just can't understand how you…
Rob
  • 7,980
  • 30
  • 75
  • 115
42
votes
3 answers

Really simple encryption with C# and SymmetricAlgorithm

I'm looking for a very simple crypt / decrypt method. I will be using always the same static key. I'm aware of the risks of this approach. Currently I'm using the following code but it does not generate the same result after crypting and decripting…
Ignacio Soler Garcia
  • 21,122
  • 31
  • 128
  • 207
42
votes
9 answers

Is it better to encrypt a message and then compress it or the other way around? Which provides more security?

I have the assumption there is no added protection at all.
john
  • 435
  • 1
  • 4
  • 4
42
votes
1 answer

Android Fingerprint API Encryption and Decryption

I am using the Android M Fingerprint API to allow users to login to the application. To do this I would need to store the username and password on the device. Currently I have the login working, as well as the Fingerprint API, but the username and…
Bryan
  • 14,756
  • 10
  • 70
  • 125
42
votes
2 answers

What is null key encryption?

In the movie Dark Knight, the Batman builds some ultra powerful sonar monitoring system and encrypts it with "Null Key Encryption". I was reading RFC 2410 but couldn't comprehend it. It says something like this: However there are cases when only…
Ravi Gupta
  • 4,468
  • 12
  • 54
  • 85
42
votes
7 answers

Should all sites use SSL by default?

We are in the process of moving our web architecture to a new environment. Included are dozens of different sites ranging from almost completely static to dynamic sites requiring authentication and containing sensitive content. Our web server admins…
Jason
  • 17,276
  • 23
  • 73
  • 114
42
votes
6 answers

Load a RSA private key in Java (algid parse error, not a sequence)

I'm trying to load a private RSA key generated with ssl into java, my code is: Generate the key: openssl genrsa -out mykey.pem 1024 Result: -----BEGIN RSA PRIVATE…
Addev
  • 31,819
  • 51
  • 183
  • 302
42
votes
1 answer

Questions about Google Play application assets encryption

Starting from v4.1 Jelly Bean, Google has introduced a new application assets encryption feature for Google Play. Seems that there were some problems when upgrading apps consisting in persistent data being lost after reboot, caused by the change in…
Mister Smith
  • 27,417
  • 21
  • 110
  • 193
41
votes
5 answers

Encrypt and decrypt a password in Java

I want to encrypt and decrypt a password in Java and store into database in the form of encrypted. It will great if it is open source. Any suggestions / pointers ?
Raje
  • 3,285
  • 15
  • 50
  • 70
41
votes
3 answers

How do you set SSE-S3 or SSE-KMS encryption on S3 buckets using Cloud Formation Template?

I'm trying to use a CloudFormation Template to spin up an S3 Bucket in AWS. One of the requirements for this project is that the bucket be encrypted in place. I've been trying to find a way to set that up via CloudFormation Template (I've read all…
Jay Carr
  • 1,195
  • 6
  • 16
  • 32
41
votes
3 answers

Passphrase, Salt and IV, do I need all of these?

If I am using Rijndael CBC mode, I have no idea why we would need salt. My understanding is even if people know the password, but he cannot get the data without IV. So from my perspective, password + IV seem to be sufficent secure. Do I get anything…
Kelvin
  • 1,103
  • 2
  • 11
  • 16