Questions tagged [encryption-symmetric]

A type of encryption where the same key is used to encrypt and decrypt the message.

Symmetric encryption is the oldest and best-known technique. A secret key, which can be a number, a word, or just a string of random letters, is applied to the text of a message to change the content in a particular way. This might be as simple as shifting each letter by a number of places in the alphabet (known as the Caesar Cipher), or as complicated as the Advanced Encryption Standard, which is used in some modern cryptography. Anyone who knows the key can either encrypt or decrypt a message.

Note that symmetric encryption does not require that the encryption and decryption key be identical, but rather that both keys derive from the same knowledge. For example, a letter-shifting cipher might require that "A" be enciphered as "G" - the opposite operation would be needed to decrypt.

736 questions
6
votes
2 answers

Encrypting JWT security token supported algorithms

I'm trying to sign and encode my JWt with this snippet: var claims = new Claim[] { new SomeClaimes() }; var scKey = Encoding.UTF8.GetBytes("SOME KEY"); var ecKey = Encoding.UTF8.GetBytes("SOME OTHER KEY"); var tokenDescriptor = new…
amiry jd
  • 27,021
  • 30
  • 116
  • 215
6
votes
1 answer

Am I doing AES 256 encryption and decryption Node.js correctly?

I need to encrypt a chat message that will be stored a database. The data is a string of characters of various lengths. I want to use the native node.js crypto library and use a symmetric encryption protocol such as AES 256. I have concerns are the…
jpotts18
  • 4,951
  • 5
  • 31
  • 31
6
votes
1 answer

Deriving a secret from a master key using JCE/JCA

Can some point me in the right direction? I'd like to use JCE/JCA to derive a new key from a master secret key, How can I achieve this? Regards.
Lekkie
  • 355
  • 5
  • 18
6
votes
1 answer

How to manage secret Key in java

I am developing a Java cryptography application. I want to encrypt a file using symmetric algorithms such as AES or DES and store the secretKey in a database for future decryption of the file. I am wondering how to store the SecretKey object in a…
Lokesh Kumar
  • 801
  • 2
  • 8
  • 13
6
votes
4 answers

Preventing MITM attacks on server

Two clients Alice and Bob use a server to login and exchange messages through the server. On login, they both send their public keys to be stored on the server. When Alice wants to speak to Bob, she enrypts a symmetric key with Bob's public key and…
6
votes
1 answer

Encryption and Decryption using C++

I've got a buffer, in which i'm adding some plain text. I want to use openssl AES encryption to encrypt the text, then decrypt it, and print it back on the screen. Code is running with no errors. #include #include #include…
Dani Marian Morar
  • 222
  • 1
  • 3
  • 12
5
votes
1 answer

Should one use Cryptographic message syntax (CMS) for this task?

I've the task to transfer small binary messages (1 or 2 kb long) between a desktop application and mobile devices. The messages should be encrypted asymmetrically (RSA for instance). From what I've learned one should use a hybrid cryptosystem for…
5
votes
1 answer

How do I replicate this .NET generated key using Python?

I am using the following .NET code to generate a key from a password and salt: static byte[] GenerateKey(string password, string salt, int size) { var saltBytes = Encoding.Unicode.GetBytes(salt); var derivedBytes = new…
Scott Baker
  • 10,013
  • 17
  • 56
  • 102
5
votes
1 answer

AES encryption with BouncyCastle: AESEngine, AESFastEngine OR AESLightEngine?

I want to port this simple JAVA example... AES Encryption/Decryption with Bouncycastle Example in J2ME ...to C# and have the two following 3 questions: As I understand, the JAVA example uses AESEngine for encryption/decryption operations. What is…
Mike
  • 1,992
  • 4
  • 31
  • 42
5
votes
3 answers

Occasional Bad Data Error while decrypting the string : System.Security.Cryptography.CryptographicException

In my ASP.NET WebForms App (The app is running on windows server 2008 R2, IIS 7.5 and Runtime v4.0 Integrated Mode App Pool if it matters), I am encrypting data, putting it on the QueryString and decrypting data using…
tugberk
  • 57,477
  • 67
  • 243
  • 335
5
votes
2 answers

How to generate hard to guess referral / coupon codes?

I'm having a difficult time coming up with an algorithm that can create short (8 character) referral codes. I want to use an easy to remember pattern where it's not possible to have offensive words show up in the codes. I also don't want any…
noctufaber
  • 764
  • 2
  • 10
  • 24
5
votes
5 answers

Simple Javascript encryption using Libsodium.js in this sandbox demo

I've spent an embarrasing number of hours trying to get Libsodium.js to work. See my fiddle demo (and code pasted below too). I keep getting Error: wrong secret key for the given ciphertext. What I would prefer is to replicate this PHP example of…
Ryan
  • 22,332
  • 31
  • 176
  • 357
5
votes
0 answers

How to decrypt(offline) value that is protected by SQL Server AEAD_AES_256_CBC_HMAC_SHA_256

It is possible to manually decrypt value that is encrypted by sql server always encrypted mechanizm? I mean how to decrypt column value that is encrypted by AEAD_AES_256_CBC_HMAC_SHA_256 algorithm. I have encryption key(in other topic I was asking…
5
votes
1 answer

Using libsodium XChaCha20-Poly1305 for large files

I was looking through libsodium, and in particular at the symmetric encryption option XChaCha20-Poly1305. What I can't get my head around is that libsodium appears to provide no "context/update/finalise" style of working that you commonly find in…
Little Code
  • 1,315
  • 2
  • 16
  • 37
5
votes
1 answer

AES encryption on iOS and android, output and buffer size is different

Implementing AES256 on iOS using CCCrypt function. But output and output buffer length is different than Android. Cipher class in Android produces 48 bytes data where in iOS we get 80 bytes data. In IOS using kCCAlgorithmAES, kCCOptionPKCS7Padding…
Pradip
  • 677
  • 9
  • 26