encryption

C# TripleDES ECB Encryption in PHP

∥☆過路亽.° 提交于 2021-02-10 19:34:07
问题 I mostly work with PHP, but I'm sending data to an api that's using C# for encryption, so I'm trying to encrypt a password in PHP, using the same method used in the following C# code: System.Security.Cryptography.TripleDESCryptoServiceProvider DES = new System.Security.Cryptography.TripleDESCryptoServiceProvider(); System.Security.Cryptography.MD5CryptoServiceProvider hashMD5 = new System.Security.Cryptography.MD5CryptoServiceProvider(); DES.Key = hashMD5.ComputeHash(System.Text.ASCIIEncoding

C# TripleDES ECB Encryption in PHP

守給你的承諾、 提交于 2021-02-10 19:32:11
问题 I mostly work with PHP, but I'm sending data to an api that's using C# for encryption, so I'm trying to encrypt a password in PHP, using the same method used in the following C# code: System.Security.Cryptography.TripleDESCryptoServiceProvider DES = new System.Security.Cryptography.TripleDESCryptoServiceProvider(); System.Security.Cryptography.MD5CryptoServiceProvider hashMD5 = new System.Security.Cryptography.MD5CryptoServiceProvider(); DES.Key = hashMD5.ComputeHash(System.Text.ASCIIEncoding

MachineKeyDataProtector - Invalid link when confirmation email sent through background job

筅森魡賤 提交于 2021-02-10 12:28:12
问题 I've been pulling my hair out over this. Anytime a user registration email is sent out via my windows service (background task), I get an "Invalid link". My setup I'm using Hangfire as a windows service on our development server. This is where the problematic GenerateEmailConfirmationToken call is happening. It's in a completely different context, outside of the ASP.NET pipeline. So I have setup machineKey values to correspond with that in the web.config of the MVC application: In the app

Convert openssl AES in Php to Python AES

大兔子大兔子 提交于 2021-02-10 06:14:45
问题 I have a php file which is as follow: $encryption_encoded_key = 'c7e1wJFz+PBwQix80D1MbIwwOmOceZOzFGoidzDkF5g='; function my_encrypt($data, $key) { $encryption_key = base64_decode($key); $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-cfb')); $encrypted = openssl_encrypt($data, 'aes-256-cfb', $encryption_key, 1, $iv); // The $iv is just as important as the key for decrypting, so save it with encrypted data using a unique separator (::) return base64_encode($encrypted . '::'

RSA Encryption function in Swift 4 from Public Key string

我怕爱的太早我们不能终老 提交于 2021-02-09 07:09:31
问题 My ultimate goal is to create a JWE string, given a public key for iOS. To make things easier for myself, I've broken down my steps so most pressingly, I need to create an encrypted key using RSA encryption from a secret key and public key string. I've tried a lot of things found here in stack overflow and other places of the internet. For various reasons they just haven't worked out. I am being guided by some Objective C code: /* Device Data encryption - create JWE given DS publicKey */ +

Create pgp file with gpg from command line

非 Y 不嫁゛ 提交于 2021-02-08 15:14:47
问题 I want to encrypt an xml file and I am using gpg4win (kleopatra). Using the kleopatra interface I set an option to produce files with extension pgp instead of gpg which is the default extension. I am trying to create a pgp file from command line using the command gpg -r test@test.gr -se C:\temp\myfile.xml because I need to submit it in a web app that accepts pgp only. I have tried to put some other options in the command but I always get a gpg file. How can I produce a pgp file from command

Create pgp file with gpg from command line

六月ゝ 毕业季﹏ 提交于 2021-02-08 15:10:36
问题 I want to encrypt an xml file and I am using gpg4win (kleopatra). Using the kleopatra interface I set an option to produce files with extension pgp instead of gpg which is the default extension. I am trying to create a pgp file from command line using the command gpg -r test@test.gr -se C:\temp\myfile.xml because I need to submit it in a web app that accepts pgp only. I have tried to put some other options in the command but I always get a gpg file. How can I produce a pgp file from command

JAVA Signature Object - No installed provider supports this key: sun.security.rsa.RSAPrivateCrtKeyImpl

夙愿已清 提交于 2021-02-08 13:24:22
问题 I want to sign a file i created using a pair of RSA keys I created using key tool and the following command: keytool -genkeypair -alias key -keyalg RSA -keysize 2048 -sigalg SHA256withRSA -validity 365 -keystore keystore.jks I want to initialize my Signature object so I tried this: PrivateKey privateKey = (PrivateKey) keyStore.getKey(PRIVATE_KEY_ALIAS,privateKeyPassword); Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); signature.initSign(privateKey); But I got this exception

how to create a random generated alphabet in Java

早过忘川 提交于 2021-02-08 12:18:52
问题 Looking to create a randomly generated alphabet for a substitution cipher. My idea was something like this. char randomChar = (char) (97 + r.nextInt(25)); However this will cause repetition of letters. Going through the char array and seeing if the letter is already present seems inefficient also. edit: I was too vague in my request and see this now. Here is the full question I am trying to solve. The alphabet must also contain the space button character e.g ' '. Write a Java program which

how to create a random generated alphabet in Java

落爺英雄遲暮 提交于 2021-02-08 12:18:52
问题 Looking to create a randomly generated alphabet for a substitution cipher. My idea was something like this. char randomChar = (char) (97 + r.nextInt(25)); However this will cause repetition of letters. Going through the char array and seeing if the letter is already present seems inefficient also. edit: I was too vague in my request and see this now. Here is the full question I am trying to solve. The alphabet must also contain the space button character e.g ' '. Write a Java program which