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
127
votes
5 answers

AES Encryption for an NSString on the iPhone

Can anybody point me in the right direction to be able to encrypt a string, returning another string with the encrypted data? (I've been trying with AES256 encryption.) I want to write a method which takes two NSString instances, one being the…
Boz
  • 1,646
  • 5
  • 15
  • 15
126
votes
10 answers

mcrypt is deprecated, what is the alternative?

The mcrypt-extension is deprecated will be removed in PHP 7.2 according to the comment posted here. So I am looking for an alternative way to encrypt passwords. Right now I am using something like mcrypt_encrypt(MCRYPT_RIJNDAEL_128, md5($key, true),…
Piet
  • 2,188
  • 5
  • 19
  • 30
123
votes
3 answers

Remove 'b' character do in front of a string literal in Python 3

I am new in python programming and i am a bit confused. I try to get the bytes from a string to hash and encrypt but i got b'...' b character in front of string just like the below example. Is any way avoid this?.Can anyone give a solution? Sorry…
Panagiotis Drakatos
  • 2,851
  • 4
  • 31
  • 43
120
votes
14 answers

Javascript AES encryption

Is there a library available for AES 256-bits encryption in Javascript?
coder
  • 2,239
  • 5
  • 22
  • 20
119
votes
10 answers

Initial bytes incorrect after Java AES/CBC decryption

What's wrong with the following example? The problem is that the first part of the decrypted string is nonsense. However, the rest is fine, I get... Result: `£eB6O�geS��i are you? Have a nice day. @Test public void testEncrypt() { try { …
TedTrippin
  • 3,525
  • 5
  • 28
  • 46
119
votes
6 answers

How to encrypt/decrypt data in php?

I'm currently a student and I'm studying PHP, I'm trying to make a simple encrypt/decrypt of data in PHP. I made some online research and some of them were quite confusing(at least for me). Here's what I'm trying to do: I have a table consisting of…
Randel Ramirez
  • 3,671
  • 20
  • 49
  • 63
116
votes
5 answers

What is the difference between DSA and RSA?

It appears they are both encryption algorithms that require public and private keys. Why would I pick one versus the other to provide encryption in my client server application?
WilliamKF
  • 41,123
  • 68
  • 193
  • 295
113
votes
6 answers

What's the difference between SHA and AES encryption?

What's the difference between SHA and AES encryption?
Pete
112
votes
3 answers

SVN encrypted password store

I installed SVN on a Ubuntu machine and I can't get my head around something. Whenever I checkout something from the terminal I get this error about saving a non-encrypted…
treznik
  • 7,955
  • 13
  • 47
  • 59
111
votes
7 answers

AES vs Blowfish for file encryption

I want to encrypt a binary file. My goal is that to prevent anyone to read the file who doesn't have the password. Which is the better solution, AES or Blowfish with the same key length? We can assume that the attacker has great resources…
mimrock
  • 4,813
  • 8
  • 32
  • 35
111
votes
10 answers

The necessity of hiding the salt for a hash

At work we have two competing theories for salts. The products I work on use something like a user name or phone number to salt the hash. Essentially something that is different for each user but is readily available to us. The other product…
kemiller2002
  • 113,795
  • 27
  • 197
  • 251
109
votes
10 answers

Image encryption/decryption using AES256 symmetric block ciphers

Is there any good example of how to encrypt and decrypt image and other files with AES on Android?
hardartcore
  • 16,886
  • 12
  • 75
  • 101
109
votes
8 answers

Can't check signature: public key not found

I try to decrypt file using following command: gpg --output file.txt --decrypt file.pgp File is decrypted successfully but i get an error: "gpg: Can't check signature: public key not found" Any idea, why I get this error?
codelikeprogrammerwoman
  • 1,429
  • 3
  • 14
  • 17
107
votes
5 answers

What's the difference between id_rsa.pub and id_dsa.pub?

Is one more secure than the other?
Andrew
  • 1,071
  • 2
  • 8
  • 3
106
votes
7 answers

How to Export Private / Secret ASC Key to Decrypt GPG Files

Background: My boss has tried exporting an ASC key to me with public and private parts but whenever I get the file the private part never loads up and it won't decrypt any files. We have tried Exporting the ASC Key using: Windows Application…
Brian McCarthy
  • 4,658
  • 16
  • 49
  • 66