cryptography

How can I encypt a parameter with Rijndael in C#?

旧街凉风 提交于 2020-06-29 03:37:06
问题 How can I encrypt a parameter variable using the encryption method Rijndael ? I would like to encrypt some parameters in order to post them in an API call. The key should be in a specific form , 1st Key + IV Key . In addition , the 1st key should have a specific format. If anyone is able to provide a code sample for this, it would be awesome. 来源: https://stackoverflow.com/questions/62569677/how-can-i-encypt-a-parameter-with-rijndael-in-c

Sign and verify using ed25519 in near protocol

一笑奈何 提交于 2020-06-27 18:37:37
问题 I am trying to sign the message in javascript using signMessage and verify it with python for implementing jwt authentication. This is the code for signing message in javascript using near-api-js window.signer = await new nearlib.InMemorySigner(window.walletAccount._keyStore) const mysign = await window.signer.signMessage("Amiya", window.walletAccount._authData.accountId, window.walletAccount._networkId) let mypubdata = "" mysign.publicKey.data.forEach( function (item,index){ if(item < 16) {

how to compare a password text with the bcrypt hashes?

梦想的初衷 提交于 2020-06-27 10:23:45
问题 I have a use case in my application that should prevent the user from choosing one of their last 3 passwords while resetting their password. I'm using Angular for the front end and Spring Boot for the back end . In my scenario, the user passwords are stored as bcrypt hash. How can I compare the password entered by the user with the last 3 stored bcrypt passwords? When I run the following code snipped example, BCryptPasswordEncoder b = new BCryptPasswordEncoder(); for(int i =0;i<10;i++) {

First 8 byes of my encrypted data corrupting using 3DES and CBC

拥有回忆 提交于 2020-06-27 08:42:28
问题 I'm using PyCrypto in an application to encrypt data, but for some reason the first 8 bytes (corresponding to the first block) are coming through corrupt no matter what I do. >>> from Crypto.Cipher import DES3 >>> from Crypto import Random >>> iv = Random.new().read(DES3.block_size) >>> key = Random.new().read(DES3.key_size[-1]) >>> des3 = DES3.new(key, DES3.MODE_CBC, iv) >>> des3.decrypt(des3.encrypt('12345678abcdefgh12345678')) 't\x1b\x0f\xcbD\x15M\xababcdefgh12345678' I've read that that's

Store data securely in memory (password based encryption)

混江龙づ霸主 提交于 2020-06-27 05:48:10
问题 I have to store the key into memory. So as security concern we can not store the cryptographic key into the memory directly, We need to store the key in Encrypted way. So the idea is we store the key in encrypted manner and at the time of crypto operation, just decrypt the key and use it and dispose the key. So we are using Password based encryption(PBE) define in BouncyCastle c# version Example code. The problem in code is that the password is fix here. I have to generate the password at run

Store data securely in memory (password based encryption)

馋奶兔 提交于 2020-06-27 05:47:11
问题 I have to store the key into memory. So as security concern we can not store the cryptographic key into the memory directly, We need to store the key in Encrypted way. So the idea is we store the key in encrypted manner and at the time of crypto operation, just decrypt the key and use it and dispose the key. So we are using Password based encryption(PBE) define in BouncyCastle c# version Example code. The problem in code is that the password is fix here. I have to generate the password at run

OpenSSL Sign and Verify in C with RAW EC generated Keys

江枫思渺然 提交于 2020-06-26 12:26:29
问题 I generate my EC private key as random number and my EC public key as the multiplication of the generator for the random number. Now I would to use these keys to sign and verify a message, but the operation about the verification fails. Do you have any hint to solve this problem? I'm using OpenSSL 1.0.0 for some constraints. I cannot switch the new one. #include <openssl/ec.h> #include <openssl/rand.h> #include <openssl/bn.h> #include <openssl/sha.h> #include <openssl/evp.h> #include <openssl

md5 hash a large file incrementally?

只谈情不闲聊 提交于 2020-06-25 18:03:13
问题 In the browser, I read in a file using the JS FileReader().readAsBinaryString(). Using the CryptoJS library I can MD5 hash the data. This works fine but I do not know how to handle large files. E.g. Just reading a 2GiB file crashes the browser window. I can slice blobs from the file data and hash that as I go but wouldn't this prevent anyone else from verifying the same hash without following the same steps as me? Is there a way to get the md5 hash of a large file in this circumstance? How

basics of python encryption w/ hashlib sha1

青春壹個敷衍的年華 提交于 2020-06-24 21:42:26
问题 I'm struggling to fully understand how encryption works and is coded, particularly with python. I'm just trying to get the basics down and create code in the simplest form. I'm going to be passing a userID between two different sites, but obviously I need this to be encrypted with a private key so Website2 knows it came from Website1. This seems to be the code for me: http://docs.python.org/library/hashlib.html#module-hashlib, but it doesn't have very good examples (or maybe I'm in the wrong

How can I customize the Cryptographic Service Provider (Base CSP) in the Smart card subsystem architecture

爷,独闯天下 提交于 2020-06-17 15:46:51
问题 From microsoft documentation In steps 6 and 7 ( Kerberos SSP <-> CSP or Base CSP ): In essence, it exchanges a copy of the x.509 certificate (from a smart card) in the pre-authentication data field of the request and is signed by the private key. I wonder if there is any method to customize CSP (Cryptographic Service Provider) so that Kerberos SSP can get x.509 certificate (self-created) without using smart card? Then from Kerberos SSP send the certificate to AD (active directory). Link