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
53
votes
3 answers

What is point of SSL if fiddler 2 can decrypt all calls over HTTPS?

I asked a question here a while back on how to hide my http request calls and make them more secure in my application. I did not want people to use fiddler 2 to see the call and set up an auto responder. Everyone told me to go SSL and calls will be…
Landin Martens
  • 3,283
  • 12
  • 43
  • 61
52
votes
11 answers

How do you hide secret keys in code?

I've wondered for some time how some software hides secret keys in such a way that they can't be trivially discovered. Just a few examples: DVD Player Software hides CSS keys Software with serial numbers/registration codes hides keys/hashes used to…
TTar
  • 905
  • 1
  • 8
  • 12
52
votes
5 answers

Should jwt web token be encrypted?

I was reading article on JWT web token as an access token that is being response to the user. Some of it mention that the web token should be able to be decoded by the user. Does it means that it is not a good practice to decrypt the entire web…
vincentsty
  • 2,963
  • 7
  • 34
  • 51
50
votes
2 answers

Decrypt password created with htpasswd

I created a protection for my web pages with apache2 in ubuntu. Now I am creating an application in c++ and I want it uses the same file that Apache2 uses for authentification, but my problem is that I don't know how to decrypt the password…
Mils
  • 1,479
  • 3
  • 19
  • 42
50
votes
5 answers

RSA Encryption Decryption in Android

I am implementing a demo for RSA Encryption and Decryption in Android. I can Perform Encryption very well, but In Decryption I get an Exception: >>java.security.InvalidKeyException: unknown key type passed to RSA. KeyPairGenerator kpg; …
Riddhi Barbhaya
  • 1,205
  • 1
  • 11
  • 19
49
votes
5 answers

How do RSA tokens work?

I would like to understand how RSA tokens (SecurID) work, what is the algorithm used there, is it the same algorithm as the regular RSA encryption/decryption ?
Jau L
  • 904
  • 2
  • 8
  • 20
49
votes
10 answers

Storing credit card details

I have a business requirement that forces me to store a customer's full credit card details (number, name, expiry date, CVV2) for a short period of time. Rationale: If a customer calls to order a product and their credit card is declined on the spot…
Andrew
  • 11,894
  • 12
  • 69
  • 85
49
votes
4 answers

How do I generate a SALT in Java for Salted-Hash?

I've been looking around and the closest answer is : How to generate a random alpha-numeric string? I want to follow this workflow according to this CrackStation tutorial: To Store a Password Generate a long random salt using a CSPRNG. Prepend…
Louis Hong
  • 1,051
  • 2
  • 12
  • 27
48
votes
7 answers

Does AES (128 or 256) encryption expand the data? If so, by how much?

I would like to add AES encryption to a software product, but am concerned by increasing the size of the data. I am guessing that the data does increase in size, and then I'll have to add a compression algorithm to compensate.
Bob Kuhl
48
votes
3 answers

Why is using a Non-Random IV with CBC Mode a vulnerability?

I understand the purpose of an IV. Specifically in CBC mode this insures that the first block of of 2 messages encrypted with the same key will never be identical. But why is it a vulnerability if the IV's are sequential? According to CWE-329…
rook
  • 66,304
  • 38
  • 162
  • 239
47
votes
5 answers

How can I list the available Cipher algorithms?

I am getting a Cipher implementation with Cipher.getInstance(String algorithm). I am under the impression that the available algorithm names that I may pass differ based on what libraries which are present in my classpath. I would like to write a…
skiphoppy
  • 97,646
  • 72
  • 174
  • 218
47
votes
4 answers

Fast and simple String encrypt/decrypt in JAVA

I need fast and simple way to encrypt/decrypt a "lot" of String data. I tried jasypt but it crashes on my Android phone. I have about 2000 records (strings). BasicTextEncryptor textEncryptor = new…
svenkapudija
  • 5,128
  • 14
  • 68
  • 96
47
votes
16 answers

How to make auto trust gpg public key?

I am trying to add my GPG public key as a part of our appliance installation process. The purpose of it to encrypt any important files like logs before admin pulling them into his local using admin portal and then decrypt them using private key. The…
user1366786
  • 991
  • 4
  • 9
  • 19
46
votes
7 answers

Get all messages from Whatsapp

I'm trying to implement an app that will show in a textview all the messages received from Whatsapp. Is there any way to do it? Is it possible to extract all the messages from Whatsapp?
user1141833
  • 479
  • 1
  • 5
  • 4
46
votes
4 answers

Differences Between Rijndael and AES

I'm investigating encryption algorithms - can someone give me a quick rundown of the differences between Rijndael and AES?
Peter
  • 37,042
  • 39
  • 142
  • 198