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
46
votes
4 answers

Problem Updating to .Net 6 - Encrypting String

I'm using a string Encryption/Decryption class similar to the one provided here as a solution. This worked well for me in .Net 5. Now I wanted to update my project to .Net 6. When using .Net 6, the decrypted string does get cut off a certain point…
Optim
  • 523
  • 1
  • 5
  • 9
46
votes
1 answer

Why does my AES encryption throws an InvalidKeyException?

I'm currently working on a function that encrypt/decrypts a specific file with a secret key. I have written three classes, one which generates a key, one which encrypts a file with the key and one that decrypts. Generating the key and encrypting the…
John Snow
  • 5,214
  • 4
  • 37
  • 44
46
votes
12 answers

JSchException: Algorithm negotiation fail

I am trying to connect to remote sftp server over ssh with JSch (0.1.44-1) but during session.connect(); I am getting this exception: com.jcraft.jsch.JSchException: Algorithm negotiation fail at…
Marek Dominiak
  • 693
  • 1
  • 7
  • 9
46
votes
2 answers

Does my JDBC connection to the database use SSL or not?

How can one know if the JDBC connection to an SQL server is secure (i.e. uses SSL) or not? Is it obvious for example from the URL. Do all JDBC drivers support SSL connections to the database server, or does the use of SSL just depends on the…
Cratylus
  • 52,998
  • 69
  • 209
  • 339
46
votes
3 answers

Encryption vs. digest

What is the difference between encryption and a digest?
hd.
  • 17,596
  • 46
  • 115
  • 165
45
votes
3 answers

How to encrypt one entry in web.config

ASP.NET 4 I've used RSA key encryption for connection strings in web.config on my web farm. However, there's one more custom password entry that I'd like to encrypt. How should I encrypt it with RSA key without having the rest configurations being…
Stan
  • 37,207
  • 50
  • 124
  • 185
45
votes
4 answers

sqlite encryption for android

i'm looking very hard for a possibility to encrypt my sqlite database on Android devices, but I was't able to find a satisfying solution. I need something like a libary to reference, in order to have a "on the fly" encryption/decryption of my…
2red13
  • 11,197
  • 8
  • 40
  • 52
45
votes
1 answer

How to encrypt user data in Firebase

I am using the email/password sign in method for Firebase. I would like to encrypt the data users save into the realtime database before sending it to the database. Firebase already handle the user password, but can I somehow use it to encrypt data…
45
votes
13 answers

Is there an encrypted version control system?

I am looking for an encrypted version control system . Basically I would like to Have all files encrypted locally before sending to the server. The server should never receive any file or data unencrypted. Every other feature should work pretty…
Dez Udezue
  • 759
  • 1
  • 6
  • 16
45
votes
5 answers

Encrypt with PHP, Decrypt with Javascript (cryptojs)

I'm having trouble with basic encryption/decryption. I've looked all around for a working example but haven't quite found a working example. -I will be encrypting in php, decrypting with cryptojs for a small layer of security
user2769
  • 459
  • 1
  • 5
  • 3
45
votes
3 answers

How to use public and private key encryption technique in C#

I want to encrypt data using public/private key technique. I mean, encrypt with the public key of receiver and the receiver can decrypt with their own private key. How can I do that? Do you have any suggestion or sample code ?
cagin
  • 5,772
  • 14
  • 74
  • 130
44
votes
7 answers

Postfix and OpenJDK 11: "No appropriate protocol (protocol is disabled or cipher suites are inappropriate)"

I know there are some other questions (with answers) to this topic. But none of these was helpful for me. I have a Postfix server (postfix 3.4.14 on Debian 10 (Buster)) with the following configuration (only the interesting…
Steffen
  • 2,500
  • 4
  • 31
  • 47
44
votes
4 answers

Encryption/decryption doesn't work well between two different openssl versions

I've downloaded and compiled openssl-1.1.0. I can encrypt and decrypt using the same exe of openssl (as is here) me@ubuntu:~/openssl-1.1.0$ LD_LIBRARY_PATH=. ./apps/openssl aes-256-cbc -a -salt -in file.txt -out file.txt.enc enter aes-256-cbc…
hudac
  • 2,584
  • 6
  • 34
  • 57
44
votes
2 answers

How to extract the RSA public key from a .cer and store it in a .pem using OpenSSL?

I have the requirement to extract the public key (RSA) from a *.cer file. I wish to extract the key and store it in a .pem file so I can use its value to encrypt values using jsencrypt. The following command converts a .cer to .pem: openssl x509…
Steven Anderson
  • 8,398
  • 4
  • 27
  • 32
44
votes
5 answers

git encrypt/decrypt remote repository files while push/pull

Is it possible to automatically encrypt files via 'git push' before transferring to a remote repository? And automatically decode them while 'git pull'. I.e, if I have some remote server with shared access with git repository there, and I don't want…
UncleMiF
  • 1,051
  • 2
  • 11
  • 20