symmetric-key

how to 'Zero out' from memory an AES SecretKeySpec Key in Java

放肆的年华 提交于 2021-02-19 02:25:27
问题 I am using Java AES encryption using SecretKeySpec(byte[] key, String algorithm) to generate a Key object. After I encrypt something, I want to remove the Key from memory. I can remove all references to the Key, but that does not guarantee that the key is not floating somewhere in memory. I can "zero out" the byte[] array that I used to generate the Key, but how can I zero out or flush the actual Key memory. 回答1: There doesn't appear to be a way to do this in Java versions up to 7, but it has

Why Primary key and Secondary key in Azure IoT hub?

徘徊边缘 提交于 2020-06-25 09:36:28
问题 When creating a shared access policy or registering a device in Azure IoT hub, there will be a Primary key and Secondary key pair generated. And I noticed I can connect a device to IoT hub using either Primary key or Secondary key. So, what's the purpose to have Primary/Secondary keys? How should I design the use of both keys? 回答1: The goal of primary and secondary key is two-fold. First of all it would allow you to keep using your service when you want to replace your key. Say you connect

Symmetric key storage

我的梦境 提交于 2019-12-20 09:36:42
问题 My company is going to be storing sensitive data for our customers, and will be encrypting data using one of the managed .NET encryption algorithm classes. Most of the work is done, but we haven't figured out how/where to store the key. I've done some light searching and reading, and it seems like a hardware solution might be the most secure. Does anyone have any recommendations on a key storage solution or method? Thanks for your replies, everyone. spoulson, the issue is actually both the

OpenSSL EVP API: How to decrypt the encrypted file using a symmetric key file

我们两清 提交于 2019-12-20 04:52:35
问题 Hi I'm working on C on Linux. I have a query related to symmetric key decryption. I have generated an symmetric key using the below command. openssl rand base64 512 > sym.key Using this key ( sym.key ) I have encrypted a file with below command. openssl enc -aes-256-cbc -in temp.txt -out temp.enc -kfile sym.key It has generated an encrypted file temp.enc . Now, I have to use the same key ( sym.key ) with EVP Decrypt API's and have to decrypt this encrypted file. Could any one suggest me a

Generating a symmetric key in php

走远了吗. 提交于 2019-12-11 22:07:28
问题 Im trying to generate a symmetric key, which i can use to both encrypt and decrypt a message with the same key, in php. I've made my way through the php documentation below but can only find public/private key generations: http://www.php.net/manual/en/function.openssl-pkey-new.php Any ideas on how i can use these key generating functions for making a symmetric key? Thanks, Joe 回答1: A symetric key is basically a random set of bytes. If you want to use the openssl extension use openssl_random

Rijndael key size in C#

人走茶凉 提交于 2019-12-10 16:30:06
问题 I'm currently developing a little tool in C# that allows me to quickly crypt my files. So I used this script which looks to be perfect for me. But I still have a problem : the key is too short (8 character max). I read in RijndaelManaged() documentation that maximum size for the key is 256 bits, so I should be able to use a 64 character key... (like sha256 hash) But every time I try to increase the key size, I get a nice "Encryption failed !", even for 9 characters. I've been looking for a

Why is AES more secure than DES?

南楼画角 提交于 2019-12-03 18:30:22
问题 I am beginning to learn crypto algorithms and I understand how the above mentioned algorithms work. Is it that the key length of AES is longer? Which steps of AES encryption makes it less vulnerable than DES? 回答1: DES was designed with an effective key length of 56 bits, which is vulnerable to exhaustive search. It also has some weaknesses against differential and linear cryptanalysis: these allow to recover the key using, respectively, 2 47 chosen plaintexts, or 2 43 known plaintexts. A

Symmetric key storage

烈酒焚心 提交于 2019-12-02 19:05:35
My company is going to be storing sensitive data for our customers, and will be encrypting data using one of the managed .NET encryption algorithm classes. Most of the work is done, but we haven't figured out how/where to store the key. I've done some light searching and reading, and it seems like a hardware solution might be the most secure. Does anyone have any recommendations on a key storage solution or method? Thanks for your replies, everyone. spoulson, the issue is actually both the "scopes" that you mentioned. I suppose I should have been clearer. The data itself, as well as the logic

OpenSSL EVP API: How to decrypt the encrypted file using a symmetric key file

前提是你 提交于 2019-12-02 04:25:26
Hi I'm working on C on Linux. I have a query related to symmetric key decryption. I have generated an symmetric key using the below command. openssl rand base64 512 > sym.key Using this key ( sym.key ) I have encrypted a file with below command. openssl enc -aes-256-cbc -in temp.txt -out temp.enc -kfile sym.key It has generated an encrypted file temp.enc . Now, I have to use the same key ( sym.key ) with EVP Decrypt API's and have to decrypt this encrypted file. Could any one suggest me a better approach for this. Here is the code unsigned char* decode (unsigned char *key, int len) { BIO *b64,

How to backup Symmetric Key in SQL Server?

Deadly 提交于 2019-12-01 19:57:29
I use the next code to create SQL Encryption keys CREATE MASTER KEY ENCRYPTION BY PASSWORD = '<Pass>' CREATE CERTIFICATE MyEncryptCert WITH SUBJECT = 'Descryption', EXPIRY_DATE = '2115-1-1' CREATE SYMMETRIC KEY MySymmetricKey WITH ALGORITHM = AES_256 ENCRYPTION BY CERTIFICATE MyEncryptCert How I encrypt data OPEN SYMMETRIC KEY MySymmetricKey DECRYPTION BY CERTIFICATE MyEncryptCert SET @Result = ENCRYPTBYKEY(KEY_GUID('MySymmetricKey'), '<String to encrypt>') CLOSE SYMMETRIC KEY MySymmetricKey I am able to backup Database Master Key and Certificate. BACKUP MASTER KEY TO FILE = 'c:\temp\key'