cryptography

Krakenex API multiple pairs query

亡梦爱人 提交于 2021-02-07 20:01:21
问题 I am trying to use the Krakenex python library to query the order book for multiple currency pairs at once. When I do it for a single currency is works, like this: con = krakenex.API() con.load_key('kraken.key') con.query_public('Depth', {'pair':'GNOETH'}) However, if I do: con = krakenex.API() con.load_key('kraken.key') con.query_public('Depth', {'pair':['GNOETH', 'GNOEUR']}) I get {'error': ['EQuery:Unknown asset pair']} . I assume that the syntax is incorrect but can't figure out the

Use of “SHA1PRNG” in SecureRandom Class

南笙酒味 提交于 2021-02-07 18:39:37
问题 I have a basic question. Why 'SHA1PRNG' is used in SecureRandom Class. It will be helpful if someone explains about it. Thanks in advance. EX: SecureRandom.getInstance("SHA1PRNG"); 回答1: Warning In my opinion it is bad to directly rely on this algorithm. Please see this answer on SO where I show why relying on specific SecureRandom algorithms is bad. Note that although most runtimes will have a provider with an "SHA1PRNG" implementation, the Java specifications do not require the the

How to run dbms_crypto functions in Oracle as regular user?

筅森魡賤 提交于 2021-02-07 13:55:18
问题 I have problem with using dbms_crypto.hash() function in Oracle. I connected to database server using sqlplus as "sys/passwd as sysdba", then I installed dbms_crypto package: @/home/oracle/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/dbmsobtk.sql @/home/oracle/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/prvtobtk.plb Grant execute on dbms_crypto to public; Grant execute on dbms_sqlhash to public; Grant execute on dbms_obfuscation_toolkit to public; Grant execute on dbms_obfuscation

java - decrypt a file with base64

你。 提交于 2021-02-07 11:10:26
问题 In my project a textfile is chosen and become encrypted. The encrypted text is saved seperatly as well as the key. Now I try to create a program which is decrypting the file when the right keyfile is available. I think the decrypting program needs to look pretty like the encrypting program just in DECRYPT_MODE . When I read in the key I don't know how to do the next step at it to decrypt the textfile. Maybe anyone can help me how I use the key from .txt file and use it to decrypt the encoded

Forge: Encrypt large file

China☆狼群 提交于 2021-02-07 09:40:31
问题 I use forge framework for some kind of PGP realization. So I need to encrypt very larg file (2gb or more) and keep it encrypted. I want to use as small RAM memory as possible. What is the best way to do it? 回答1: This is a general design issue -- not so much related to forge. Like MDG said, you'll need to use streaming to avoid keeping the whole file and encrypted file in memory. Forge's cipher objects (see: AES) will allow you to consume chunks of data from a stream. You can do cipher.update(

Is std::random_device cryptographic secure?

牧云@^-^@ 提交于 2021-02-07 05:36:14
问题 I see many people talk about security and std::random_device together. For example, here slide 22. According to cppreference, std::random_device : std::random_device is a uniformly-distributed integer random number generator that produces non-deterministic random numbers. It does not talk about security explicitly. Is there any valid reference that explicitly mentions std::random_device is secure for cryptography? 回答1: No, because that's not what std::random_device is designed for; it's

Java SecretKeyFactory generated key is same as input password

匆匆过客 提交于 2021-02-07 04:31:26
问题 I'm trying to generate a secret key using PBE but the secret key generated by the SecretKeyFactory is exactly the same as the input password. I've tried different algorithms, iteration counts etc. and it is still the same so I feel I'm missing a step here. public SecretKey generateKey(String password, String salt) { char[] passChars = password.toCharArray(); byte[] saltBytes = salt.getBytes(); SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("PBEWithHmacSHA256AndAES_128");

Java SecretKeyFactory generated key is same as input password

ぐ巨炮叔叔 提交于 2021-02-07 04:31:05
问题 I'm trying to generate a secret key using PBE but the secret key generated by the SecretKeyFactory is exactly the same as the input password. I've tried different algorithms, iteration counts etc. and it is still the same so I feel I'm missing a step here. public SecretKey generateKey(String password, String salt) { char[] passChars = password.toCharArray(); byte[] saltBytes = salt.getBytes(); SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("PBEWithHmacSHA256AndAES_128");

Decrypting OpenSSL-encrypted file on Android with Java

左心房为你撑大大i 提交于 2021-02-06 14:05:43
问题 I'm currently trying to implement file decryption on my Android app. The file will be encrypted on host(Linux) using something like : openssl aes-128-ecb -salt -k $HASH -in somefile.in -out somefile openssl aes-256-cbc -salt -K $HASH -iv $IV -md sha1 -in somefile.in -out somefile openssl aes-256-cbc -d -salt -K $HASH -md sha1 -in somefile.in -out somefile The problem is that, I CANNOT get any of these combinations(128/256, ecb/cbc, salt/nosalt, -K/-k, -md/none) to properly decrypt on Android.

Python to C# AES CBC PKCS7

て烟熏妆下的殇ゞ 提交于 2021-02-06 11:11:03
问题 I'm trying to convert this C# code to Python (2.5, GAE). The problem is that the encrypted string from the python script is different each time the encryption (on the same string) is run. string Encrypt(string textToEncrypt, string passphrase) { RijndaelManaged rijndaelCipher = new RijndaelManaged(); rijndaelCipher.Mode = CipherMode.CBC; rijndaelCipher.Padding = PaddingMode.PKCS7; rijndaelCipher.KeySize = 128; rijndaelCipher.BlockSize = 128; byte[] pwdBytes = Encoding.UTF8.GetBytes(passphrase