cryptography

AES256 CBC + HMAC SHA256 ensuring confidentiality *and* authentication?

限于喜欢 提交于 2019-12-31 08:49:11
问题 I'm thinking of using AES256 CBC + HMAC SHA-256 as a building block for messages that ensures both confidentiality and authentication. In particular, consider this scenario: Alice is possession a public key belonging to Bob (the key exchange and algorithm is outside the scope of this question). Alice has an identifying key K, also shared with Bob, that she can use to identify herself with. Only Alice and Bob knows the key K. Alice encrypts (nonce || K) using Bob's public key. Bob decrypts the

Delphi AES library (Rijndael) tested with KAT Vectors

ぐ巨炮叔叔 提交于 2019-12-31 07:16:08
问题 for these 2 libraries, Delphi Encryption Compendium v 5.2 TurboPower Lockbox v 2.07 I tested their Rijndael DCB/CBC algorithm with "AES Known Answer Test (KAT) Vectors" obtained at NIST website (http://csrc.nist.gov/groups/STM/cavp/index.html) But, both of these libraries failed the tests. Not sure if it was my testing that has error, has anyone tested them before as well? I am looking for a Delphi Rijndael library that is able to pass the KAT Vectors test. Does anyone know of any such

Java ECDSAwithSHA256 signature with inconsistent length

倖福魔咒の 提交于 2019-12-31 05:31:26
问题 So I am trying to generate an ECDSAwithHA256 signature in Java, and for that, I am using the BouncyCastle provider. The curve is a secp521r1. To initalize the signer I am using: public static final String SIGNATURE_ALGORITHEM = "SHA256withECDSA"; public void init() { signer = Signature.getInstance(SIGNATURE_ALGORITHEM, BouncyCastleProvider.PROVIDER_NAME); signer.initSign(privKey); } And to sign I am using public byte[] sign(byte[] bytes) throws SignatureException { signer.update(bytes); byte[

Importing PKCS#8 encrypted key to RSACng?

霸气de小男生 提交于 2019-12-31 05:27:08
问题 If I have encrypted RSA key in PKCS#8, can I somehow import it to RSACng as CngKeyBlobFormat.Pkcs8PrivateBlob ? Or does this CngKeyBlobFormat.Pkcs8PrivateBlob just shows the CngKey that during import the key must be decoded from DER to get key parameters and then they are imported into RSACng , thus the answer is no? 回答1: CNG understands how to decrypt encrypted PKCS#8, but you need to give it a password. Since .NET doesn't ask you for the password (and it gets passed via a manner other than

AES decryption error “ The input data is not a complete block.” Error vb.net

試著忘記壹切 提交于 2019-12-31 05:14:37
问题 I keep getting this "The input data is not a complete block." error while decrypting. The function successfully encrypts plain text and puts the IV in a textbox. I am using the encrypted data and the IV from text to decrypt the original data but I keep getting the error. I have no idea where I have gone wrong. Heres my code Imports System.IO 'Import file I/O tools Imports System.Security.Cryptography 'Import encryption functionality Imports System.Text 'Import text based processing tools`

difference between the methods update() and dofinal() in cipher

让人想犯罪 __ 提交于 2019-12-31 04:37:07
问题 I have read one article about difference between the methods update() and dofinal() in cipher. It was about what will happend if we want to encrypt 4 Bytes Array, when the block size of the cipher is for example 8 Bytes. If we call update here it will return null. My question is: what will happen if we call doFinal() with a 4 byte array to encrypt, and the buffer size is 8 bytes, how many bytes encoded data will we receive on the return? 回答1: update() : feed the data, again and again, enables

difference between the methods update() and dofinal() in cipher

耗尽温柔 提交于 2019-12-31 04:37:05
问题 I have read one article about difference between the methods update() and dofinal() in cipher. It was about what will happend if we want to encrypt 4 Bytes Array, when the block size of the cipher is for example 8 Bytes. If we call update here it will return null. My question is: what will happen if we call doFinal() with a 4 byte array to encrypt, and the buffer size is 8 bytes, how many bytes encoded data will we receive on the return? 回答1: update() : feed the data, again and again, enables

Does the SHA1PRNG algorithm for SecureRandom use /dev/random for entropy?

情到浓时终转凉″ 提交于 2019-12-31 04:33:20
问题 I tried looking for this in the javadocs and online but couldn't find a definitive answer. The answer by Dan Dyer in How to solve performance problem with Java SecureRandom? Seems to suggest SHA1PRNG does not use any system resources for entropy. Is this correct? 回答1: No, in the default Oracle implementation it uses system resources, unless you seed it before calling nextBytes() . From the Sun/Oracle documentation of SecureRandom : The SecureRandom implementation attempts to completely

A shorter non-repeating alphanumeric code than UUID in MySQL

折月煮酒 提交于 2019-12-31 03:26:45
问题 Is it possible for MySQL database to generate a 5 or 6 digit code comprised of only numbers and letters when I insert a record? If so how? Just like goo.gl, bit.ly and jsfiddle do it. For exaple: http://bit.ly/ 3PKQcJ http://jsfiddle.net/ XzKvP cZ6ahF, 3t5mM, xGNPN, xswUdS... So UUID_SHORT() will not work because it returns a value like 23043966240817183 Requirements: Must be unique (non-repeating) Can be but not required to be based off of primary key integer value Must scale (grow by one

C# Unsigned bytes Encryption to Java Signed bytes Decryption

纵然是瞬间 提交于 2019-12-31 03:17:26
问题 I have an application in C# that encrypt part of my files (because they are big files) using RijndaelManaged. So I convert my file to byte arrays and encrypt only a part of it. Then I want to decrypt the file using Java. So I have to decrypt only part of the file (means those bytes) that was encrypted in C#. Here the problem comes. Because in C# we have unsigned bytes and in Java we have signed bytes . So my encryption and decryption not working the way I want. In C# I have joined the