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

Encrypt Existing Database with SQLCipher in Android

I have a database file in my assets that I copy in the app database folder. After the copy (it works), I want to encrypt the copied database with SQLCipher. For some reason, I get this error: Database: sqlite returned: error code = 26, msg =…
Mr.Sparkle
  • 173
  • 1
  • 9
8
votes
0 answers

android 6.0 javax.crypto.BadPaddingException: error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT

this code works well before android 6.0, but get an error on 6.0 if encrypted file size less than about 1k bytes. public static byte[] decode(byte[] decrypteSrcBuffer) throws Exception { Key deskey = null; DESedeKeySpec spec = new…
8
votes
3 answers

openssl_encrypt() randomly fails - IV passed is only ${x} bytes long, cipher expects an IV of precisely 16 bytes

This is the code I use to encrypt/decrypt the data: // Set the method $method = 'AES-128-CBC'; // Set the encryption key $encryption_key = 'myencryptionkey'; // Generet a random initialisation vector $iv =…
wube
  • 923
  • 2
  • 10
  • 22
8
votes
5 answers

Why do I have "Checksum fail" on every bad SQL request in Oracle when Native Encryption (ASO) is enabled?

We recently configured our Oracle database to be in so-called native encryption (Oracle Advanced Security Option). As development goes on, some SQL queries are sometimes badly-written and so an error should be returned by the JDBC driver (ojdbc7…
Cyrille Pontvieux
  • 2,356
  • 1
  • 21
  • 29
8
votes
2 answers

Secure communication between linked SQL Servers

Is the data transferred between two SQL Servers protected (encrypted) by default? If not, is there a way to accomplish this? I have two SQL Server 2005 databases running on separate servers, separate machines, separate networks. How can I ensure…
Sebastian G
  • 81
  • 1
  • 1
  • 2
8
votes
2 answers

Is there a pure Erlang cryptography library with support for AES?

I need to use AES encryption in my embedded Erlang application, but OpenSSL is unavailable for my target system and so the crypto library from OTP can't be built. I probably could cross-compile OpenSSL as well, but I would prefer a pure Erlang…
Alexey Romanov
  • 167,066
  • 35
  • 309
  • 487
8
votes
1 answer

Adding Encryption to Solr/lucene indexes

I am currently using Solr to perform search services over some sensitive records. As Solr/lucene provides fast searching by storing inverted indexes of the sensitive information in plain text on a disk there is a requirement to encrypt these index…
8
votes
2 answers

Decrypting an OpenSSL PEM Encoded RSA private key with Java?

I have an encrypted private key and I know the password. I need to decrypt it using a Java library. I'd prefer not to use BouncyCastle though, unless there is no other option. Based on previous experience, there is too much change and not enough…
rimsoft
  • 105
  • 1
  • 1
  • 5
8
votes
1 answer

Implementing CSRF protection in a Python REST API

Writing a REST API with Pyramid/Cornice using JWT for authentication, I'll have to implement some CSRF protection. Having thoroughly read up on the topic I understand the problem, but I'm pretty confused about the best way to implement it, it's a…
Christian Benke
  • 517
  • 7
  • 26
8
votes
3 answers

Best practice for securing username/password between clients and server

Got an application (C# WPF) that needs to "call home" and get updated stuff from a home server. In theory there could be thousands of client out there, needing to communicate over the public internet. Each user will first register with a username…
Rune Jacobsen
  • 9,907
  • 11
  • 58
  • 75
8
votes
3 answers

Encrypting a large file with AES using JAVA

I've tested my code with files less than this(10mb, 100mb, 500mb) and the encryption works. However, I run in to problems with files greater than 1gb. I've generated a large file (about 2gb) and I want to encrypt it with AES using JAVA, but I'm…
halcyondayz
  • 83
  • 1
  • 1
  • 3
8
votes
1 answer

Proper password storage and retrieval for service accounts?

Most of the information that I found and read about properly storing passwords in a database say that I should Hash the password clear text with a unique salt value for each user and then store that hash in the database. But this process doesn't…
λ Jonas Gorauskas
  • 6,121
  • 6
  • 45
  • 66
8
votes
1 answer

Getting error "data too large for key size" with Crypto Node.js

I'm getting the error "Error: error:0406C06E:rsa routines:RSA_padding_add_PKCS1_type_1:data too large for key size" when I do: var crypto = require('crypto'); var fs = require('fs'); var first_keys = { public_key:…
arturojain
  • 167
  • 1
  • 4
  • 15
8
votes
3 answers

Crypto.js decrypt with key and iv (vector) in byte arrays

I have to decrypt some strings which are AES encrypted. Example encrypted string: 129212143036071008133136215105140171136216244116 I have a key, and a vector (iv) supplied to me in a byte-array format: Key: [ 123, 217, 20, 11, 24, 26, 85, 45,…
Mbmahs
  • 111
  • 1
  • 1
  • 5
8
votes
2 answers

Optimising SHA-1 for small input

I'm hoping to optimise an implementation of SHA-1 for an 8-bit MCU (8051-based). The input data is only 8-bytes, so I wonder if something could be done to improve this macro: #define S(x,n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n))) The issue I…
Kar
  • 6,063
  • 7
  • 53
  • 82