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

PKCS#11. Possibility of performing Ecryption/Decryption in hardware

Cheers. This is a copy of my question on crypto stack exchange. I'm dealing with HSM via PKCS#11 C/Python interface. I'm wondering is it possible to do some C_Encrypt/C_Decrypt in hardware. By saying "in hardware" I mean encryption/decryption…
Henadzi Matuts
  • 345
  • 2
  • 10
8
votes
2 answers

Combining JWE and JWS

Just learning about JOSE and I understand that JWE is for encryption and JWS is for signing. What I don't seem to be able to find examples of is a payload that is both encrypted and signed. Let's pretend I have a payload hello world. Is the correct…
aroooo
  • 4,726
  • 8
  • 47
  • 81
8
votes
4 answers

RijndaelManaged Decryption - How can I remove the padding /0 gracefully?

How can I remove the padding from a decrypted string? I'm using RijndaelManaged provider to encrypt and decrypt. When I decrypt there are several /0/0/0/0/0/0 at the end of the string. My question is how can I gracefully (properly) remove the…
Hcabnettek
  • 12,678
  • 38
  • 124
  • 190
8
votes
1 answer

Android AES/GCM/NoPadding Bug on certain length of input bytes?

I have written a class which is used to de-and encrypt arbitrary data. It's working like this: Because an AndroidKeyStore generated AES key is "lost" after i.e. uninstalling the app, we have a public/private key pair, where the public key is…
Rafael T
  • 15,401
  • 15
  • 83
  • 144
8
votes
1 answer

openssl_decrypt tag value

I'm using the openssl_encrypt / decrypt method in my website but i'm having some troubles with the $tag option openssl_encrypt ( $data, $method, $key, $options, $iv, $tag ) openssl_decrypt ( $data, $method, $key, $options, $iv, $tag ) from…
Joey Azar
  • 132
  • 1
  • 13
8
votes
3 answers

Exporting RSA key object to XML in Java

I am successfully running RSA encryption/decryption in Java. This is how I generated the key. ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(path)); KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA"); …
dvl
  • 741
  • 2
  • 8
  • 19
8
votes
3 answers

AES/CBC/PKCS5PADDING IV - Decryption in NodeJs (Encrypted in Java)

I am trying to decrypt in NodeJs. It is working in Java. But I am not able to achieve same in Node. node-version: 8.4 Please find my NodeJs code: var crypto = require('crypto'); function decryption (message, key) { var messageArray =…
Chaitanya Joshi
  • 304
  • 1
  • 4
  • 22
8
votes
3 answers

How to disable encryption on AWS CodeBuild artifacts?

I'm using AWS CodeBuild to build an application, it is configured to push the build artifacts to an AWS S3 bucket. On inspecting the artifcats/objects in the S3 bucket I realised that the objects has been encrypted. Is it possible to disable to…
Altus
  • 1,315
  • 3
  • 11
  • 19
8
votes
0 answers

Encrypt / decrypt file (CryptoJS)

When working on the task "Encrypt / decrypt file (CryptoJS.AES)" I encountered a problem: the official documentation is not described the process of encrypting and decrypting files. The problem was that after decryption the file was corrupted. This…
Кирилл
  • 89
  • 1
  • 2
8
votes
1 answer

Best practice for storing passwords that need to be reused?

We have an automation platform that needs to store service account passwords in a database. These passwords are used in a variety of different cases but generally need to be reversed into their original plain text form in order to be functional. The…
EndOfAll
  • 355
  • 2
  • 11
8
votes
6 answers

Encrypt/Decrypt String Kotlin

I've created this two extensions in Kotlin to Encrypt/Decrypt strings: fun String.encrypt(seed : String): String { val keyGenerator = KeyGenerator.getInstance("AES") val secureRandom = SecureRandom.getInstance("SHA1PRNG") …
MarcForn
  • 3,321
  • 7
  • 25
  • 39
8
votes
3 answers

Encryption and Security with C# and SQL

I have seen the examples but I'm hoping to run this by other programmers. For encryption within my window forms app, I am generating two random numbers and saving them in an SQL Server table like thus: OPEN SYMMETRIC KEY SymmetricKeyName…
Missy
  • 1,286
  • 23
  • 52
8
votes
7 answers

Protecting a system deployed in a "hostile" environment

At my company we are developing a large system, comprised of several servers. The system is comprised from about 5 logical components. Data is stored in XMLs, MS SQL, and SQLite. It's a .Net system(mostly) ,the components communicate using WCF, and…
AK_
  • 7,981
  • 7
  • 46
  • 78
8
votes
3 answers

Methods for encrypting an archive in C++

I'm writing a game that will have a lot of information (configuration, some content, etc) inside of some xml documents, as well as resource files. This will make it easier for myself and others to edit the program without having to edit the actual…
Derek Maciel
  • 1,275
  • 2
  • 12
  • 19
8
votes
1 answer

Unexpected result decrypting using PHP AES CCM mode

I am attempting to reproduce an encryption operation using AES-256-CCM that is currently performed in Java with the Bouncy Castle provider. When attempting the same operation in PHP using openssl I cannot find a set of parameters that produces the…
Josh Glick
  • 83
  • 3