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
2 answers

Ruby - unsupported cipher algorithm (AES-256-GCM)

I'm getting the error: unsupported cipher algorithm (AES-256-GCM) (RuntimeError) But I seem to have all the requirements: Ruby version: $ ruby --version ruby 2.1.2p95 OpenSSL does list gcm: $ openssl enc -help 2>&1 | grep gcm -aes-128-ecb …
user3813959
  • 83
  • 1
  • 3
8
votes
1 answer

Better way to create AES keys than seeding SecureRandom

I need to send encrypted data from a Java client to a C# server. Right now I'm learning how to encrypt data using AES (requirement). Following this accepted answer android encryption/decryption with AES I'm doing the following: byte[] keyStart =…
Christopher Francisco
  • 15,672
  • 28
  • 94
  • 206
8
votes
6 answers

How to Check If File is Encrypted using AES (Rijndael)

I am using 'RijndaelManaged' and 'CryptoStream' classes in C# to encrypt files. Before encrypting the files, i want to check whether the file is already encrypted or not. I tried using File.GetAttributes() method to check for Encryption but it is…
Mako
  • 1,465
  • 2
  • 18
  • 34
8
votes
4 answers

How best to encrypt/decrypt SQL Server data to prevent even developers from seeing it?

Here's an interesting problem, and I'm looking for a pattern that will keep it all workable. I am building a smart-client app for a school system. It will contain information about students including their report cards, sick days, and so forth. it…
TomK
  • 523
  • 2
  • 7
  • 18
8
votes
3 answers

Encrypted Subversion repository

Do you know of a reliable way to encrypt an entire Subversion repository? I host the repository on my dedicated server (FreeBSD), but would like to add encryption so my source code cannot be stolen in readable format if someone hacks into my…
JubbaJubba
  • 377
  • 1
  • 5
  • 14
8
votes
1 answer

How to control what users can decrypt SQL Server Symmetric Key Encryption

I am looking into encrypting some sensitive data in SQL Server, such as bank account numbers and social security numbers in order to comply with new state laws. I am using SQL Server 2008 as my database with .NET code. I have used .NET to encrypt…
Jeff Stock
  • 3,796
  • 12
  • 46
  • 61
8
votes
2 answers

cryptojs: How to generate AES passphrase

I want to generate a 256bit password for my AES encryption. When I check the password after the encryption it is different from my initial password. What am I doing wrong? Or is there some security mechanism I am not aware of? My…
Ron
  • 133
  • 1
  • 1
  • 8
8
votes
3 answers

What to do when you can not save a password as a hash

I have a program that uses System.DirectoryServices.AccountManagement.PrincipalContext to verify that the information a user entered in a setup screen is a valid user on the domain (the computer itself is not on the domain) and do some operations on…
Scott Chamberlain
  • 124,994
  • 33
  • 282
  • 431
8
votes
1 answer

Getting "EVP_DecryptFinal_ex:wrong final block length" during decryption

I followed this tutorial for encrypting and decrypting simple strings in android/java: https://stackoverflow.com/questions/4319496/how-to-encrypt-and-decrypt-data-in-java I made a Cryptography class: public class Cryptography { public static…
dgzz
  • 2,929
  • 6
  • 34
  • 56
8
votes
4 answers

java.security.UnrecoverableKeyException: no match

Problem: need to save RSA private key in encrypted place. Try to use KeyStore for this purpose. Code snippet: package com.example.encryptiontest; import java.io.FileInputStream; import java.io.FileNotFoundException; import…
Alex Klimashevsky
  • 2,457
  • 3
  • 26
  • 58
8
votes
7 answers

How to get cpu-id in java?

I want to create an encryption with java.Is there anyway to get CPU Id or anything that be unique in PC such as BIOS or ... for example System.getCpuId(); it is just an example Thanks a lot ...
Freeman
  • 9,464
  • 7
  • 35
  • 58
8
votes
3 answers

Encrypting sections and-or settings in an App.config file that will be redistributed

I'm creating a regular windows application that will be distributed to several users on my department. I'll need to include some connectivity passwords on the App.config file, and I obviously don't want end-users to just fire up notepad and look at…
GR7
  • 5,083
  • 8
  • 48
  • 66
8
votes
1 answer

AES 256 encryption in C++ and Qt 5

I have a Java code for encryption in place as follows! private static byte[] encrypt(byte[] raw, byte[] clear) throws Exception { SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); Cipher cipher = null; …
Parth Doshi
  • 4,200
  • 15
  • 79
  • 129
8
votes
2 answers

SHA256CryptoServiceProvider not FIPS compliant?

I am looking for a SHA256 implementation in C# that is FIPS compliant. It turns out that SHA1CryptoServiceProvider works. But why does SHA256CryptoServiceProvider trip the {"This implementation is not part of the Windows Platform FIPS validated…
tofutim
  • 22,664
  • 20
  • 87
  • 148
8
votes
2 answers

Converting NSData to SecKeyRef

i have a public key which i gathered from a remote server and i want to perform RSA encryption with that public key. But the problem is i get the public key data as byte array in buffer. I can convert it to NSData but i can not convert to SecKeyRef…
M. Salih Kocak
  • 189
  • 2
  • 14
1 2 3
99
100