cryptography

Substitution Encryption/Decryption in R

狂风中的少年 提交于 2021-01-28 01:57:01
问题 Using the variables alpha and key, encrypt ptext into a variable named ctext. Using substitution cipher So I have a text file separated in a vector ptext <- strsplit(ptext,split = "", fixed = TRUE) ptext <- unlist(ptext) I also created a key for this cipher key <- "ZGYHXIWJVKULTMSARBQCPDOENF" key <- unlist(strsplit(key,"")) and an Alphabet vector for the key alpha <- "ABCDEFGHIJKLMNOPQRSTUVWXYZ" alpha <= toupper(alpha) alpha <- unlist(strsplit(alpha,"")) Now my goal is to try to replace all

Storing IV when using AES asymmetric encryption and decryption

有些话、适合烂在心里 提交于 2021-01-28 00:50:59
问题 I'm looking at an C# AES asymmetric encryption and decryption example here and not sure if i should store the IV in a safe place (also encrypted??). Or i can just attach it to the encrypted text for using later when i with to decrypt. From a short reading about AES it seems it's not needed at all for decryption but i'm not sure i got it right and also the aes.CreateDecryptor(keyBytes, iv) need it as parameter. I use a single key for all encryptions. 回答1: It's fairly standard to transmit the

Is It Ever Recommended To Use The ECB Cipher Mode?

梦想的初衷 提交于 2021-01-27 14:11:26
问题 Judging from this Wikipedia article on cipher modes and other things I've heard about ECB, it's a big no-no and can leak information about your encrypted data. However, there are still plenty of examples out there on the 'net that utilize ECB: One of the top Google results for a Triple DES sample in .NET One of the answers to this question Is it ever acceptable or advantageous to use ECB? If the data is very small (one block) and you're using both a salt and an IV , is it OK? If so, where is

Decrypting the signature created by RSACryptoServiceProvider.SignData() to get the hash

断了今生、忘了曾经 提交于 2021-01-27 13:04:52
问题 I'm trying to retrieve the hash created with the RSACryptoServiceProvider class' SignData and SignHash methods. I need this to be able to store encrypted hashes that must be retrieved later because they're part of a hash chain. Initially I wanted to encrypt and decrypt hashes manually, using the private key for encryption, but the library doesn't allow it. I can't find a method that does this, and all my searches have returned answers about how private key encryption is a bad idea (when not

python decode fernet key

爷,独闯天下 提交于 2021-01-27 06:42:42
问题 I have generated few fernet keys and stored in str format for reference. Now, I need to encode these fernet keys in str format to 32 url-safe base64-encoded bytes to decrypt my data. from cryptography.fernet import Fernet as frt keys=set() keybin='keys' keybin=open(keybin,'w') for i in range(r.randint(5,14)): key=frt.generate_key() keys.add(key.decode()) for k in keys: keybin.write(str(k)) keybin.write('\n') I'm using below code to access the file and decrypt s key=linecache.getline(cfile,x)

Android - javax.crypto.AEADBadTagException

半腔热情 提交于 2021-01-27 06:27:16
问题 I'm currently getting an AEADBadTagException when trying to decrypt a file I have encrypted. I have searched pretty much everywhere on stackoverflow and unable to find a solution, and hoping there is just a small mistake I have made or something to do with encoding etc., since GCM is unable to verify the tag that it is generating. I believe the problem is somewhere in the file I am trying to encrypt/decrypt. The same exact code works on an image, however, when I try to encrypt a PDF, it fails

How to fix ImportError: No module named cryptography?

孤者浪人 提交于 2021-01-27 05:38:34
问题 I want to auto renew certificate via certbot, but not working, got error "ImportError: No module named cryptography" # ./certbot-auto --dry-run Error: couldn't get currently installed version for /opt/eff.org/certbot/venv/bin/letsencrypt: Traceback (most recent call last): File "/opt/eff.org/certbot/venv/bin/letsencrypt", line 7, in from certbot.main import main File "/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/certbot/main.py", line 10, in import josepy as jose File "/opt/eff

Obtaining the certificate chain

拈花ヽ惹草 提交于 2021-01-27 05:03:46
问题 I am working with X509 certificates in Java. Given a certificate is it possible to find all other certificates in the signing hierarchy until you reach the root certificate? I have a certificate file (with a .cer extension) and I want to extract the parent signing certificate. I want to keep finding the parent of that certificate untill I get the final root certificate, which is self signed. I have checked the X509Certificate certificate APIs and relevant APIs in java.security.cert but could

Difference Between RSA-OAEP and RSA-PKCS1.5 [closed]

风流意气都作罢 提交于 2021-01-27 04:37:51
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . Improve this question What is the different between RSA-OAEP and RSA-PKCS1.5? My understanding is they are both RSA encryption, but using different padding schemes. What is the advantage of one over the other? If I generate a RSA 2048 pirate and public key pair, can I use the same

Difference Between RSA-OAEP and RSA-PKCS1.5 [closed]

痞子三分冷 提交于 2021-01-27 04:37:10
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . Improve this question What is the different between RSA-OAEP and RSA-PKCS1.5? My understanding is they are both RSA encryption, but using different padding schemes. What is the advantage of one over the other? If I generate a RSA 2048 pirate and public key pair, can I use the same