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
1 answer

Cipher a string using crypto-js with hex encoding to make it url friendly

I am using crypto-js by brix. I have this function below that handles the encryption of a plain text. import CryptoJS from 'crypto-js' import AES from 'crypto-js/aes' const SECRET = 'I am batman' const plainText = 'This is Sparta!' export function…
jofftiquez
  • 7,548
  • 10
  • 67
  • 121
8
votes
2 answers

iOS 10 download encrypted HLS stream

I'm currently trying to implement download of an encrypted HLS stream to an iOS device. iOS 10 seems to support that out of the box (see https://developer.apple.com/videos/play/wwdc2016/504), but I can't get it to work. I am basically using the…
Micky
  • 5,578
  • 7
  • 31
  • 55
8
votes
9 answers

Easy Encryption and Decryption with PHP

My PHP Application uses URLs like these: http://domain.com/userid/120 http://domain.com/userid/121 The keys and the end of the URL are basically the primary key of the MySQL database table. I don't want this increasing number to be public and I…
norwald2
  • 131
  • 1
  • 4
8
votes
2 answers

Storing user-generated text in database securely (Ruby/Rails)

I'm trying to figure out a way to store user-generated text securely in a database (so that only the user is the one who can access his/her stored text). I could have Rails encrypt and decrypt the user's text entries using the user's password as the…
James C.
  • 83
  • 2
8
votes
1 answer

convert string to private and public key (RSA)

The two strings that are the private and public keys are : static String Public = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDH+wPrKYG1KVlzQUVtBghR8n9d" + "/n" + …
Haya Raed
  • 5,921
  • 5
  • 16
  • 19
8
votes
2 answers

Storing Passwords for Third Party Services

My application is ruby-on-rails, but I expect any answers to this question will probably be framework agnostic. My application sends emails via gmail SMTP using rails ActionMailers a-la: mail = MyActionMailerSubclass.setup_email options = {…
SooDesuNe
  • 9,880
  • 10
  • 57
  • 91
8
votes
8 answers

Let's Encrypt unauthorized 403 forbidden

On the server, Nginx is installed. Let's Encrypt is working well with www.domain.com but is not working with static.domain.com With PuTTY, when I enter : sudo letsencrypt certonly -a webroot --webroot-path=/var/www/site/domain -d static.domain.com…
8
votes
0 answers

iTunes Export Compliance and HTTPS

iTunes Export Compliance and HTTPS Hello Guys, I recently uploaded an app to Appstore and it's still in review process. Meanwhile I came across "Export Compliance" under features in My App. It basically asks me, if I have used any kind of encryption…
Advaith
  • 1,087
  • 3
  • 12
  • 31
8
votes
1 answer

InvalidKeyException: Keystore operation failed on RSA decrypt on Android device

I'm trying to perform RSA encryption and decryption on a key that's within AndroidKeyStore. Encryption completes successfully, but when I try to decrypt, it throws an InvalidKeyException: Keystore operation failed on Cipher.init(). Here's my…
user1118764
  • 9,255
  • 18
  • 61
  • 113
8
votes
2 answers

AES Encrypt using CryptoJS

I need to implement AES encryption using JavaScript. Used AES/CBC/NoPadding Mode and created a method to complete 16 lenght blocks. I already solved it using Java. It looks like: public static String encrypt(byte[] key, byte[] initVector, String…
Sergio David Romero
  • 236
  • 2
  • 6
  • 16
8
votes
2 answers

Triple DES decryption in iOS

I'm currently using the following for Triple DES decryption on iOS: NSString* plainText = @"My Text"; NSString* keyText = @"cf6f1ed3bf0a156e"; NSData *plainData = [plainText dataUsingEncoding:NSUTF8StringEncoding]; NSData *keyData =…
user481610
  • 3,230
  • 4
  • 54
  • 101
8
votes
10 answers

Is there a best .NET algorithm for credit card encryption?

The .NET System.Security.Cryptography namespace has a rather bewildering collection of algorithms that I could use for encryption of credit card details. Which is the best? It clearly needs to be secure for a relatively short string. EDIT: I'm in…
Jeremy McGee
  • 24,842
  • 10
  • 63
  • 95
8
votes
1 answer

Using ColdFusion to sign data for single sign-on

I apologize in advance for the length of this post. I don't really know enough about this issue to properly identify what the specific problem may actually be! But at any rate, we've been making calls against our membership API to query info about…
daltec
  • 447
  • 1
  • 5
  • 15
8
votes
1 answer

How to manually decrypt a file encrypted via git crypt

I'm using a CI build that downloads a zip archive from github. At build time, I need to decrypt a file that has been encrypted with git-crypt using gpg. However, the CI build cannot decrypt the files because it is not a cloned directory tree and…
SenseDeep
  • 3,026
  • 3
  • 17
  • 19
8
votes
1 answer

Failed to decrypt using provider 'DataProtectionConfigurationProvider' in app.config

I used following method to encrypt connectionstrings section of my app.config in my WinForms project(I'm using Code First EF in my project): public static void EncryptConfig(string exeConfigName) { var config =…
Masoud
  • 8,020
  • 12
  • 62
  • 123