encryption-symmetric

PHP equivalent of .net AES encryption

笑着哭i 提交于 2019-12-02 13:35:35
I am working on a data exchange integration with my client and the data they send me is encrypted using their C# encrypt method (below). My app is running PHP 5.3 and I need an equivalent code to decrypt the data they send. I have the PHP code but it'd not decrypt the client data correctly for me. Clearly I am making some mistake in my encryption/decryption methods, IV key or something. Can anyone spot the mistake? Thanks. C# Code (From my client): using System; using System.Security.Cryptography; using System.Text; using System.IO; public class Program { public static void Main() { var text =

How to decrypt a string encrypted by V FoxPro

自古美人都是妖i 提交于 2019-12-02 09:02:51
I have a program built in Visual Fox Pro which read and write information in a database, but the information is encrypted. I have the source code so, I have the key (same key to encrypt and dencrypt) use to encrypt/decrypt. But I cannot get the algorithm used to encrypt/dencrypt. I need this in order to create a new program with C# which can read the information and save it in another DB. Below you have some examples of the information encrypted: ùœ¢Qa³•ù¼?- pJ´’ˆò»Æ8-skYIÞµ§¬†Œ‚„Šç 럭IpAÔúùÈP@kJ´’ˆò»Æ8-skYIÞµ§¬†Œ‚„Šç I read that VFP doesn't have a native algorithm to encrypt so the developer

Simple Javascript encryption using Libsodium.js in this sandbox demo

拟墨画扇 提交于 2019-12-02 02:29:08
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 function simpleEncrypt($message, $key) into Libsodium.js. But as a starter, I'd be happy even getting the basic sample from the Libsodium.js repo to work. Any hints? Here is the code (also shown in the working fiddle): const _sodium = require("libsodium-wrappers"); const concatTypedArray = require("concat-typed-array"); (async () => { await _sodium

Simple Javascript encryption using Libsodium.js in this sandbox demo

守給你的承諾、 提交于 2019-12-02 00:15:15
问题 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 function simpleEncrypt($message, $key) into Libsodium.js. But as a starter, I'd be happy even getting the basic sample from the Libsodium.js repo to work. Any hints? Here is the code (also shown in the working fiddle): const _sodium = require(

How To Decrypt AWS Ruby Client-side Encryption in Python

我的梦境 提交于 2019-12-01 02:59:58
问题 AWS's S3 SDK for Ruby allows for client-side ('envelope') encryption of the file. It's a combination of AES CBC/ECB encryption for the client-side key where the envelope key and initialization vector are stored in the metadata. I have a Ruby developer that has encrypted various files in an S3 bucket that I need to retrieve and decrypted with Python. The Python S3 AWS SDK doesn't currently have this client-side feature. Assuming the file was encrypted using the encryption_key parameter of the

C# to Java DES encryption

十年热恋 提交于 2019-12-01 02:01:45
Trying to create java class which will encrypt and decrypt as like C# code in below. Below is my code for C#, I need to convert it to Java. Can someone help me how to do it? I've been doing this for almost 2 days yet can't find any solutions on how to convert it. I am new to crypto. Note - It seems C# code used ACME libraries. But in my java, i should not use ACME jar files. public static string EncryptBase64(string key, string clearText) { if (key.Length > 8) key = key.Substring(0, 8); byte[] keyBytes = System.Text.Encoding.ASCII.GetBytes(key); byte[] clearBytes = GetClearTextBytes(clearText)

Securely Storing Optional Entropy While Using DPAPI

99封情书 提交于 2019-11-30 20:18:19
So I am trying to store the symmetric key using DPAPI. All is well and great, but what to do with the entropy? This answered question here really doesn't provide enough insight. It seems like a slippery slope - I could use the machine store to store the entropy but then what prevents someone from getting at that as well? Note: I am storing the current key using the User Scope. So my question is - what is the best way to store the entropy using DPAPI? Anything you store locally can be compromised. But there are steps you can take to make it more difficult. There is a document on Handling

BadPaddingException: invalid ciphertext

亡梦爱人 提交于 2019-11-30 10:39:21
I would like some help as this is my first time in coding cryptography code. The encryption code appears to be working correctly, but the decryption throws an error. The error I get is: de.flexiprovider.api.exceptions.BadPaddingException: invalid ciphertext in the decrypt function towards the end of the code, which is marked as a comment // ERROR THROWN HERE! .............................. I have included all the imports, please excuse this, as thought it maybe relevant to the issue. Any help as to what I am doing wrong will be greatly appreciated, thanks very much. Code: import java.io

Securely Storing Optional Entropy While Using DPAPI

假装没事ソ 提交于 2019-11-30 03:32:33
问题 So I am trying to store the symmetric key using DPAPI. All is well and great, but what to do with the entropy? This answered question here really doesn't provide enough insight. It seems like a slippery slope - I could use the machine store to store the entropy but then what prevents someone from getting at that as well? Note: I am storing the current key using the User Scope. So my question is - what is the best way to store the entropy using DPAPI? 回答1: Anything you store locally can be

Hybrid cryptosystem implementation in .net. Error Specified key is not a valid size for this algorithm

大兔子大兔子 提交于 2019-11-29 18:10:15
I am trying to implement hybrid cryptosystem as mentioned in https://en.wikipedia.org/wiki/Hybrid_cryptosystem At the moment I have implemented following algorithm private void button1_Click(object sender, EventArgs e) { CspParameters cspParams = new CspParameters { ProviderType = 1 }; RSACryptoServiceProvider rsaProvider = new RSACryptoServiceProvider(1024, cspParams); string publicKey = Convert.ToBase64String(rsaProvider.ExportCspBlob(false)); string privateKey = Convert.ToBase64String(rsaProvider.ExportCspBlob(true)); string symmericKey = "Kamran12"; txtEncryptedData.Text = EncryptData