aes

Java PBEWithMD5AndDES

試著忘記壹切 提交于 2019-12-05 15:44:20
问题 I am using password based encryption. My initial thought was to use AES to encrypt the file which contains passwords. Turns out password based encryption does not support AES. It uses DES. AFAIK des is not secure. Is PBEWithMD5AndDES secure enough to thrust my data or should i look for another implementation? 回答1: It appears from your comments that what you would like to do is to encrypt a file which contains sensitive information, using a password-based encryption scheme, with a password

Go AES CFB compatibility

拜拜、爱过 提交于 2019-12-05 15:38:17
I am developing a client-side app in Go that relies on AES CFB. The server-side is written in C. My problem is that Go's AES CFB implementation appears to differ from many others (including OpenSSL). I wrote this to test my theory:- package main import ( "fmt" "encoding/hex" "crypto/cipher" "crypto/aes" ) func encrypt_aes_cfb(plain, key, iv []byte) (encrypted []byte) { block, err := aes.NewCipher(key) if err != nil { panic(err) } encrypted = make([]byte, len(plain)) stream := cipher.NewCFBEncrypter(block, iv) stream.XORKeyStream(encrypted, plain) return } func decrypt_aes_cfb(encrypted, key,

攻防世界 MISC篇

天涯浪子 提交于 2019-12-05 15:38:04
Excaliflag   一张图片,winhex打开没什么发现,分值不高,应该属于常见的图片隐写题目。如果对于图片的格式有详细的了解,应该很容易就能够知道了属于最低有效位( LSB )隐写,下面是通过photoshop来处理得到的flag. 签到题   Base64、栅栏、凯撒;可以直接通过在线网站解密了,在这里使用python来求解(纯属练习练习下代码) import base64 # base64解密 def b64Decode(): s="Z2dRQGdRMWZxaDBvaHRqcHRfc3d7Z2ZoZ3MjfQ==" temp=str(base64.b64decode(s),encoding = "utf-8") return temp # 栅栏密码 def zhalan(s): #确定可能的栏数 s_len = len(s) field=[] for i in range(2,s_len): if(s_len%i==0): field.append(i) mingwen="" for j in field: k=int(s_len/j) for a in range(j): for m in range(k): mingwen=mingwen+s[a] a=a+j # 分割字符串 n=0 list=[] for i in range(int(len(mingwen)/s

RijndaelManaged supports 128-256 bit key, what key size the default constructor generator?

余生颓废 提交于 2019-12-05 12:51:16
问题 For new RijndaelManaged(), the documentation says it supports keys of 128 bits and up to 256 bits. When you instantiate new RijndaelManaged(), it creates the Key and IV for you. What size does it default to, 128 bits? 回答1: The default key size is 256 bits, while the default blocksize is 128 bits. 来源: https://stackoverflow.com/questions/281158/rijndaelmanaged-supports-128-256-bit-key-what-key-size-the-default-constructor

What is the default IV when encrypting with aes_256_cbc cipher?

自古美人都是妖i 提交于 2019-12-05 12:18:18
问题 I've generated a random 256 bit symmetric key, in a file, to use for encrypting some data using the OpenSSL command line which I need to decrypt later programmatically using the OpenSSL library. I'm not having success, and I think the problem might be in the initialization vector I'm using (or not using). I encrypt the data using this command: /usr/bin/openssl enc -aes-256-cbc -salt -in input_filename -out output_filename -pass file:keyfile I'm using the following call to initialize the

How to generate a symmetric key with Bouncy Castle?

旧街凉风 提交于 2019-12-05 11:56:15
How can I generate a symmetric key with Bouncy Castle? Both PrivateKeyFactory and PublicKeyFactory seem related to AsymmetricKeyParameter . I don't want to know any JCA/JCE API - instead I'm only interested in Bouncy Castle specific API. Can (should) I just generate a random bytes? AES does not have any weak keys, so a straightforward random generation should be fine. // SecureRandom is expensive to initialize (takes several milliseconds) – // consider keeping the instance around if you are generating many keys. SecureRandom random = new SecureRandom(); byte[] keyBytes = new byte[16]; random

AES_128_CTR encryption by openssl and PyCrypto

拜拜、爱过 提交于 2019-12-05 11:48:40
Wondering the right way to convert a AES_128_CTR encryption by openssl to PyCrypto. First, I did an encryption by openssl as following: openssl enc -aes-128-ctr -in input.mp4 -out output.openssl.mp4 -K 7842f0a1ebc38f44e3e0c81943f68582 -iv d01f40dfc8ec8cd9 And then, I tried to do the same thing through PyCrypto: from Crypto.Cipher import AES from Crypto.Util import Counter key = '7842f0a1ebc38f44e3e0c81943f68582' iv = 'd01f40dfc8ec8cd9' ctr_e = Counter.new(128, initial_value=int(iv, 16)) encryptor = AES.new(key.decode('hex'), AES.MODE_CTR, counter=ctr_e) with open('output.pycrypto.mp4', 'wb')

Cannot decrypt long AES-256 GCM message with Java

和自甴很熟 提交于 2019-12-05 11:12:39
问题 Related to this question: Cannot decrypt AES-256 GCM with Java The Java decrypt issue seems to only be fixed if the encrypted message is short, i.e. two words or so. I've tried with the words, "hello" and "short string", and both of these words were decrypted fine. When I tried something like, Alphanumeric string test1 with more numbers such as 5, 4, 3, 2, 1 AEADBadTagException came up again. EDIT: This issue is directly related to how long the encrypted message is. Two words is a bit of an

Decrypt AES/CBC/PKCS5Padding with CryptoJS

為{幸葍}努か 提交于 2019-12-05 11:04:49
问题 I generate 128bit AES/CBC/PKCS5Padding key using Java javax.crypto API. Here is the algorithm that I use: public static String encryptAES(String data, String secretKey) { try { byte[] secretKeys = Hashing.sha1().hashString(secretKey, Charsets.UTF_8) .toString().substring(0, 16) .getBytes(Charsets.UTF_8); final SecretKey secret = new SecretKeySpec(secretKeys, "AES"); final Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, secret); final

How can I mcrypt 128 CFB to Ruby?

↘锁芯ラ 提交于 2019-12-05 10:56:21
I need to exchange with a PHP API which crypts the requests and answers. On my side I am in rails 4.0.0 (ruby 2.0) and I cannot make it work. I have read a lot of answers on this subject and have tried to understand how mcrypt works, e.g. http://www.chilkatsoft.com/p/php_aes.asp , but without success. I still cannot decrypt the encrypted from PHP or encrypt something that the PHP can decrypt Could you help me please and see what I am doing wrong? PHP code: $secretKey = "1234567891234567"; $encrypt = urlencode( base64_encode( mcrypt_encrypt( MCRYPT_RIJNDAEL_128, md5($secretKey), $cleartext,