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
79
votes
20 answers

Login without HTTPS, how to secure?

For a webapplication, when HTTPS is not available as a security measure, is it possible to still make the login somewhat secure? E.g.: Tokenize logins, to make repeat attacks difficult? Somehow encrypt the sent password from a HTML password…
sibidiba
  • 6,270
  • 7
  • 40
  • 50
78
votes
14 answers

Why is security through obscurity a bad idea?

I recently came across a system where all of the DB connections were managed by routines obscured in various ways, including base 64 encoding, md5sums and various other techniques. Why is security through obscurity a bad idea?
Jrgns
  • 24,699
  • 18
  • 71
  • 77
78
votes
6 answers

Salt Generation and open source software

As I understand it, the best practice for generating salts is to use some cryptic formula (or even magic constant) stored in your source code. I'm working on a project that we plan on releasing as open source, but the problem is that with the source…
user199085
  • 917
  • 2
  • 8
  • 8
77
votes
10 answers

Preferred Method of Storing Passwords In Database

What is your preferred method/datatype for storing passwords in a database (preferably SQL Server 2005). The way I have been doing it in several of our applications is to first use the .NET encryption libraries and then store them in the database as…
TheTXI
  • 37,429
  • 10
  • 86
  • 110
77
votes
3 answers

How to encrypt and decrypt file in Android?

I want to encrypt file and store it in SD card. I want to decrypt that encrypted file and store it in SD card again. I have tried to encrypt file by opening it as file stream and encrypt it but it is not working. I want some idea on how to do this.
Pratik
  • 771
  • 1
  • 6
  • 3
77
votes
11 answers

Best solution to protect PHP code without encryption

First of all, I'm not looking for miracle... I know how PHP works and that there's not really way to hide my code from the clients without using encryption. But that comes with the cost of an extension to be installed on the running server. I'm…
rfgamaral
  • 16,546
  • 57
  • 163
  • 275
76
votes
7 answers

Best way to store encryption keys in .NET C#

In our application we have a lot of sensitive configuration settings, which we are storing in a xml file which is again encrypted. This secure file has to be decrypted in runtime and the configuration values read. but an issue arises that the key…
ganeshran
  • 3,512
  • 7
  • 41
  • 69
76
votes
1 answer

OpenSSL vs GPG for encrypting off-site backups?

Given the option between using GPG and OpenSSL for local encryption before pushing archives to an off-site backup location, what are the benefits and drawbacks of each solution? Background: I currently manage a server infrastructure based on Ubuntu…
76
votes
9 answers

How do I encrypt and decrypt a string in python?

I have been looking for sometime on how to encrypt and decrypt a string. But most of it is in 2.7 and anything that is using 3.2 is not letting me print it or add it to a string. So what I'm trying to do is the following: mystring = "Hello…
David
  • 923
  • 1
  • 9
  • 11
76
votes
7 answers

Using SSL in an iPhone App - Export Compliance

I'm looking at creating an iPhone app that will communicate with a REST Web service. Because some user-sensitive data (name, address, age, etc) will be transmitted, I'm looking at securing the connections with SSL. However, on my previous escapades…
John
  • 5,452
  • 8
  • 37
  • 37
76
votes
6 answers

How do I use 3DES encryption/decryption in Java?

Every method I write to encode a string in Java using 3DES can't be decrypted back to the original string. Does anyone have a simple code snippet that can just encode and then decode the string back to the original string? I know I'm making a very…
Kyle Boon
  • 5,213
  • 6
  • 39
  • 50
76
votes
3 answers

How does the RSA private key passphrase work under the hood?

RSA private keys may be assigned a "passphrase" which - as I understand it - is intended to provide some secondary security in case someone makes off with the private key file. How is the passphrase layer of security implemented?
qfinder
  • 1,155
  • 2
  • 9
  • 9
76
votes
9 answers

Recommendations on a free library to be used for zipping files

I need to zip and password-protect a file. Is there a good (free) library for this? This needs to be opened by a third party, so the password protection needs to work with standard tools.
nearly_lunchtime
  • 12,203
  • 15
  • 37
  • 42
76
votes
3 answers

Security & Authentication: SSL vs SASL

My understanding is that SSL combines an encryption algorithm (like AES, DES, etc.) with a key exchange method (like Diffie-Hellman) to provide secure encryption and identification services between two endpoints on an un-secure network (like the…
IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756
74
votes
5 answers

How does a cryptographically secure random number generator work?

I understand how standard random number generators work. But when working with crytpography, the random numbers really have to be random. I know there are instruments that read cosmic white noise to help generate secure hashes, but your standard PC…
Byron Whitlock
  • 52,691
  • 28
  • 123
  • 168