FAQ Database Discussion Community


Aes-Gcm / Aes-Cbc - Database Storage - Column design

c#,database-design,cryptography
My question is about what I actually need to store in the DB re encrypted values and how this can be used for the nonce for GCM specifically. For reference these two answers provide sample code for encrypting data: Cbc and gcm. As I understand it, CBC requires the IV...

Loading raw 64-byte long ECDSA public key in Java

java,cryptography,digital-signature,public-key,ecdsa
I have a raw (r,s) format ECDSA NIST P-256 public key. It seems that there is no simple way to load it into an object that implements java.security.interfaces.ECPublicKey. What is the cleanest way to load a 64 byte public key so that it can be used to check signatures?...

Fast multiplication modulo 2^16 + 1

c,cryptography,modulus,algebra
The IDEA cipher uses multiplication modulo 2^16 + 1. Is there an algorithm to perform this operation without general modulo operator (only modulo 2^16 (truncation))? In the context of IDEA, zero is interpreted as 2^16 (it means zero isn't an argument of our multiplication and it cannot be the result,...

Rails request.create in rsa-sha256?

ruby-on-rails,ruby-on-rails-4,encryption,cryptography,saml
I am working on SAML authentication I have settings with digest and signature method in rsa-sha256, but when I create the request to redirect a authenticating user the request is in rsa-sha1 ... In the url, there is SigAlg=http%3A%2F%2Fwww.w3.org%2F2000%2F09%2Fxmldsig%23rsa-sha1 But I want it to be rsa-sha256 Settings : def saml_settings...

InvalidKeyException using ECPublicKey

encryption,cryptography,java
I'm getting the following exception when i try to encrypt a byte array with a EC public key : java.security.InvalidKeyException: No installed provider supports this key: sun.security.ec.ECPublicKeyImpl This exception is generated when i call Cipher.init(). The lines below show what I did in my program: ECPublicKey publicKey ; ECPrivateKey privateKey;...

Why this js code's RSA encrypted result is different from java's RSA standard code?

java,javascript,encryption,cryptography,rsa
Here is javascript code named Barrett. It can do RSA encryption and I put it into code snippet: /* * RSA, a suite of routines for performing RSA public-key computations in JavaScript. * Copyright 1998-2005 David Shapiro. * Dave Shapiro * [email protected] * changed by Fuchun, 2010-05-06 * [email protected] */...

Source text, key size relationship for encryption/decryption in Go

encryption,go,cryptography,aes,rsa
In the code below (also at http://play.golang.org/p/77fRvrDa4A but takes "too long to process" in the browser there) the 124 byte version of the sourceText won't encrypt because: "message too long for RSA public key size" of 1024. It, and the longer 124 byte sourceText version, work with 2048 bit key...

How many number of primitive operations does a 16, 32 or a 64-bit processor execute to perform logical right shift of an N-bit Binary number? [closed]

algorithm,cryptography,bit-shift,polynomial-math,ecdsa
Recently,I have been trying to understand how the Binary Extended Euclidean Algorithm works at the processor level. This question is all about finding an Inverse element in GF(2^m) with polynomial basis. Generally I came across the Extended Euclidean Algorithm for evaluating an inverse element but the fact is that it...

How unsafe is revealing a part of AES cryptographic key?

cryptography,aes
Is it crucial for AES to keep whole key in secret or it is possible, although not desirable to reveal for example first 4 chars of 16-char-long key? I want to use a part of key as a generator for a random number and curious what will happen if that...

SSL: How the client decrypt message from server

security,ssl,encryption,cryptography
I've read and watched a lot of articles and videos about SSL AES and RSA, but one thing is ALWAYS missing in every explanation( or I just don't get it ) is how the client decrypts sensitive data that comes from the server!(e.g. how much money you have) I get...

Progressive HMAC SHA256 in Objective-C

javascript,objective-c,cryptography,hmac,cryptojs
I need to generate a hash using HMAC SHA256. I am using the following code in JavaScript. I need an equivalent code in Objective-C. function serialize( obj ) { return Object.keys(obj).reduce(function(a,k){a.push(k+'='+encodeURIComponent(obj[k]));return a},[]).join('&') } var query = { Action : 'MyAction', SignatureMethod : 'HmacSHA256', }; var hmac = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, 'MYVALUE'); var...

AES encrypt in c# decrypt in T-SQL

c#,sql-server,tsql,encryption,cryptography
I have written the following code to decrypt some sensitive data, in most of the cases i need to query data using T-SQL where i can't decrypt the the data that is encrypted by this code. so my question is this how can i write a function in T-SQL that...

How to generate in C# a random number of length of 1024 bits?

c#,random,cryptography
How in C# to generate a random number with certain length in bits? It's necessary to implement a cryptographic algorithm....

java.lang.IllegalArgumentException: string curve25519 not an OID bouncycastle 1.52

java,cryptography,bouncycastle,elliptic-curve,key-pair
I'm trying to generate a key pair using the /java bouncy castle 1.52 implementation for curve 25519 what gives me java.lang.IllegalArgumentException: string curve25519 not an OID Here is my code: public KeyPair generateKeys() throws NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException { ECParameterSpec ecSpec = ECNamedCurveTable.getParameterSpec("curve25519"); KeyPairGenerator g = KeyPairGenerator.getInstance("ECDSA", "BC"); g.initialize(ecSpec, new SecureRandom());...

skip method in CipherInputStream

java,file-io,cryptography,inputstream
I am running into an issue where the code that works against a InputStream backed by a FileInputStream does not work if a CipherInputStream is used. Example is below: // skipCount is same as n in a FileInputStream FileInputStream fis; ... skipCount = fis.skip(n) Get a different behavior if a...

Speck algorithm not working

java,algorithm,encryption,cryptography,block-cipher
I am trying to implement Speck 64bit block / 128bit key cipher in java. I'm stuck at encryption / decryption algorithm. My decryption algorithm can't decrypt cipher text properly. My implementation: Encryption: int m = 4; //key words int T = 27; //rounds int alpha = 8; //alpha int beta...

c++ password handling security practices?

c++,encryption,cryptography,passwords
I am creating a c++ class that handles a username and password. I was trying to do some research on some rudimentary, but effective practices for me to handle this information, in c++, so it can't be easily found by someone, for example, scanning memory and variables to determine the...

SHA hash does not seem to be working correctly

java,hash,cryptography
I am trying to build a simple password authenticator where passwords that have been hashed using SHA-256 . I found a couple calculators online (http://onlinemd5.com/) that hashed "password" to "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8" I tried a couple other passwords with expected results. So I tried to implement a fairly straight forward set of...

How is a cryptographic hash useful if it 'cant' be decrypted?

encryption,hash,cryptography,sha
Im aware this is a dumb question, but everything I have looked up online explains either how things are hashed, how you can ATTEMPT to decrypt them, and a lotttt of topics on discussing the true 'one-way'ness of them - however i cant find something that explains their exact usage....

Rijndael file encryption / decryption

c#,cryptography,rijndael,rijndaelmanaged
I've spent the last few days creating a file encryption / decryption class based on the Rijndael encryption standard available through the RijndaelManaged class and have scoured all the resources and examples I could find. The examples were either outdated, broken or limited but have at least managed to learn...

Password hash and verification don't match

c#,asp.net,hash,cryptography,passwords
I'm writing custom forms authentication for ASP.NET MVC 5 (no, I don't want to use ASP.NET Identity). I'm trying to hash my passwords using a randomly-generated salt and then hashing salt+password using SHA512. Here are the methods I've written: private static User SetPassword(User newUser, string password) { var rand =...

Given final block not properly padded error

java,encryption,io,cryptography
I want to store an encrypted string in a file and decrypt it later. public class Main { public static void main(String[] argv) { try { writeStringAsBytes(); readStringAsBytes(); } catch(Exception error) { System.out.println(error.toString()); } } public static void readStringAsBytes() throws Exception { File file = new File("pathname"); FileInputStream fis=new FileInputStream("pathname");...

PHP Compare a crypted password from db with an inserted password from a form

php,hash,cryptography,passwords,md5
I've a db with crypted password. When a user logs in, i make this: $result = mysqli_fetch_assoc(mysqli_query($conn,$query)); $cryptedPass = $result['password']; $pass = $_POST['password']; if(strcmp($cryptedPass,md5($pass))==0) echo "yeah!"; It works, but I would like to know if this the right manner, or if there is something of safer!...

How to generate random key for HMACSHA256 signature calculation

c#,random,cryptography,hmac
I need to calculate a signature of some strings and was planning on doing this like this: using (HMACSHA256 hmacSha256 = new HMACSHA256( <randombytes>)) { Byte[] dataToHmac = System.Text.Encoding.UTF8.GetBytes(sb.ToString()); signature = Convert.ToBase64String(hmacSha256.ComputeHash(dataToHmac)); } I am going to store the key together with my user data, but i am not sure...

Visualstudio.com: Identity not verified

security,ssl,encryption,cryptography,visual-studio-online
Why when visiting our account on https://oursite.visualstudio.com does Chrome complain about the website's identity? ...

Select different padding modes in OpenSSL commands

encryption,openssl,cryptography,des
I wrote a Java Card applet to do DES encryption/Decryption. The source code of my applet (If you want to use it, consider that Mr Bodewes found some bugs in this source code (those are mentioned in the comments under his answer. So fix it and then use) have the...

Is openssl_random_pseudo_bytes truly random?

php,random,cryptography
I'm wondering about why this function has an "pseudo" on it's name. Can I trust that those bytes are really random? I didn't find any explanation about this in php's manual. openssl_random_pseudo_bytes ...

An exception of type 'System.Security.Cryptography.CryptographicException': keyset does not exist

c#,encryption,cryptography,rsa,x509certificate
All the steps made at this link System.Security.Cryptography.CryptographicException: keyset does not exist But it did not help to correct the error. static public string Build64(string idOrder, double Amount) { string StrForSign = KKBRequestStr.Replace("%ORDER%", idOrder).Replace("%AMOUNT%", string.Format("{0:f}", Amount).Replace(",", ".")); X509Certificate2 KKbCert = new X509Certificate2(KKBpfxFile, KKBpfxPass); RSACryptoServiceProvider rsaCSP = (RSACryptoServiceProvider)KKbCert.PublicKey.Key; byte[] SignData =...

How does driver signing work when Windows is offline?

windows,cryptography,driver,signing,certificate-authority
I understand the basics of signing. You must have a private key and a certificate (not necessarily) from a reputable certificate authority. You must then have the public key of the signer to verify its integrity. I can see this working online; A site is given a certificate (not necessarily)...

PHP Custom two way encryption and decryption , what i am doing wrong?

php,encryption,hash,cryptography
i am trying to obfuscate/encrypt a number into string and then again want to de-ubfuscate/decrypt that string to get a number. i cant use base64 or any other public available algorithmbs as the generated hash is gonna be personal and specific to each user and cant be shared with other...

Break bytes object into n equally sized blocks based on index

python,python-3.x,cryptography,byte,bytestring
I'm working on writing a script to break a repeating-key XOR (Vigenère) cipher. This involves determining some number (0 < n < maybe 50) then splitting up a bytes object into n smaller blocks, where the first block contains (from the original object) indexes n, 2n, 3n, next one contains...

Trying to understand RSA encryption code example

java,encryption,cryptography,rsa
I'm trying to understand this piece of code but I can't get it around my head. So the program is taking in a value and using "RSA" algorithm to encrypt it the inputted value. What I don't understand is the bytesToString part of the code. Is the program converting the...

Unable to get correct output from AES-128-GCM

c++,encryption,cryptography,aes-gcm,polarssl
The following test code should theoretically give me the result from the NIST test suite of 58e2fccefa7e3061367f1d57a4e7455a , however a hexdump of the output yields 9eeaed13b5f591104e2cda197fb99eeaed13b5f591104e2cda197fb9 instead ? #include <iostream> #include <cstdio> #include <polarssl/md.h> #include <polarssl/entropy.h> #include <polarssl/ctr_drbg.h> #include <polarssl/cipher.h> #include <cstdlib> #include <fstream> int main(int argc, char** argv) {...

Windows Crypto API CryptEncrypt with the HashObject

c,node.js,winapi,cryptography,mscapi
I'm using Windows API CryptEncrypt with CALG_AES_256 I want to use a password to encrypt, from what I understand 1. CryptAcquireContext 2. CryptCreateHash (CALG_MD5) 3. CryptHashData 4. CryptDeriveKey 5. CryptEncrypt I need to decrypt with nodejs crypto & I used openssl enc to test nodejs decrypting was successful but with...

AES encryption, got extra trash characters in decrypted file

java,android,encryption,cryptography
Im making a debug loggin function in an android app. I have a simple class which is logging to .txt file using 128 bit AES encryption. After the logging is done, i decrypt the logged file with a simple JAVA program. The problem is when i decrypt the encrypted log...

Decrypted string returns “Length of the data to decrypt is invalid”

c#,encryption,cryptography
I'm using the following snippet of code to encrypt and decrypt a string and save it to an Azure database. public class EncryptPassword { private static byte[] key = { 123, 217, 19, 11, 24, 26, 85, 45, 114, 184, 27, 162, 37, 112, 222, 209, 241, 24, 175, 144,...

C# RNGCryptoServiceProvider GetBytes(large byte array) vs looping GetBytes(1 byte)

c#,security,cryptography,rngcryptoserviceprovider
I was wondering if there's a difference in security between the following: CASE A: byte[] data = new byte[47]; using(RNGCryptoServiceProvider crypto = new RNGCryptoServiceProvider()) { crypto.GetBytes(data); } CASE B: byte[] data = new byte[47]; using(RNGCryptoServiceProvider crypto = new RNGCryptoServiceProvider()) { for(int i = 0; i < 47; i++) { byte[]...

Creating My Symmetric Key in C#

c#,security,encryption,cryptography,aes
Have been reviewing some symmetric cryptography approaches I've seen a lot of examples that hard code a private static variable in a class, usually something along the lines of: string key = "THISISYOURENCRYPTIONKEY!" and then somewhere further down, the code uses it for encrypting/decrypting. Putting aside the correct implementation/algorithm/strategy as...

What encoding does [BouncyCastle] PKCS10CertificationRequest.getEncoded() return?

java,encoding,cryptography,bouncycastle
Does it return DER encoded data, or some other format? The Javadoc I've been able to find leaves something to be desired details-wise......

Iterating over string with whitespace

c,arrays,string,cryptography
I am currently coding a little rotation programm. But i have trouble with strings like "this is a test". When I have such a string it only encodes the first 4 characters instead of the whole string.. seems like the whitespaces are breaking something up. I tried to ignore the...

WSO2 encrypt/decrypt password (string) with public-private keys

security,encryption,cryptography,wso2,wso2carbon
In WSO2 ESB (4.8.1) in BAM profile, when I export it (BAM profile), I noticed that password is encrypted. I find out that if I will have private and public key I could encrypt/decrypt password, so I write this: import org.apache.commons.codec.binary.Base64; import org.bouncycastle.jce.provider.BouncyCastleProvider; import javax.crypto.Cipher; import java.io.FileInputStream; import java.security.*; import...

How to convert C++ Rijndael Cryptography to C#, when there is an error saying “Padding is invalid and cannot be removed”?

c#,c++,cryptography,rijndael
I am trying to convert c++ source to c# which encrypt and decrypt file using Rinjdael cryptography. But c++ source has got a little bit difference from the normal en/decryptions. And I am not really good at c++, so I am getting confused. One of my customers' application is written...

Is possible to distinguish strings encrypted with different cryptography algorithms that are in the same set?

security,machine-learning,cryptography,unsupervised-learning
Is possible to distinguish strings encrypted with different cryptography algorithms? If i have a set of N encrypted strings that comes from different cryptography algorithms (i.e. 100 from AES, 150 from tripleDES, etc... ) i want to know if is possible with a reasonable error that there is a sort...

How to correct generate signature using rsa private key with java?

java,soap,cryptography,rsa,jks
I'm new in crypto with Java and I have a simple question. I have JKS keystore with SHA1withRSA trusted private key and certificate and I need to generate PKCS#7 signature for SOAP message. I tried found some info about this and at the moment, I have this: KeyStore ks =...

plaintext with private PHP

php,encryption,hash,cryptography,phpseclib
For this question, Im using Asymmetric encryption, I have private key which I want to use to sign data and public key which will verify the signature.

Is it possible to implement AES with a 64-bit I/O block size?

security,encryption,cryptography,aes
I'm working on an application with a very specific encryption requirement: We are required to encrypt/decrypt individual 64-bit values, to protect certain parts of our internal architecture from reverse engineering through our public web endpoints. The problem is, the existing 64-bit encryption methods (such as 3DES) are not secure enough...

Secure link between two peers without certificates?

java,security,encryption,cryptography,rsa
I am writing software in Java that will run on Android, Windows, Linux and OSX and want the devices to all talk to each other securely. My initial thought was just to use a asymmetric algorithm (eg. RSA) and share the public keys manually. Then sessions would be encrypted just...

How can we use hash values >= 160 bits (e.g SHA-1) in security if most computers can address only values no more than 64 bits?

hash,cryptography
So here is the confusion: in cryptography we use huge values for our hashes >= 160 bits. How can we operate on this values if most computers can address only 64 or 32 bits?

Use PHP to generate a public/private key pair and export public key as a .der encoded string

php,openssl,cryptography
Currently I have some working php code to generate a private/public keypair and store them in two variables. These variables are strings, with one variable containing the private key, and the other containing the public key. I researched on stack overflow and I also found some code to convert a...

DES Crypto applet returns errror on reception of any command

java,cryptography,javacard
In the below you see a simple Java Card applet that is written to encrypt and decrypt data with different DES and 3DES algorithms. These are supported commands : 00 C0 00 00 | KeyLength | KeyValue : To set the DES/3DES Key. (8 byte for DES, 16/24 bytes for...

How to hide the length of a decrypted string after encryption

string,encryption,cryptography,string-length
I've just written my own (simple) encryption and decryption functions... function MyEncrypt(const AValue : string; const AKey : string) : string; begin Result := //encryption end; function MyDecrypt(const AValue : string; const AKey : string) : string; begin Result := //decryption end; ...and I've got some doubts about how to...

Is it advisable to use a signature (query data hashed with a private key) as a nonce to avoid replay attacks? [closed]

security,cryptography
I'm building an API where each request query string contains the following: A timestamp A couple of data parameters A public key A signature (the data parameters and timestamp hashed with a private key) When receiving a request, the server checks the timestamp and denies requests that are too old....

What does it mean to encrypt with a public key? [closed]

security,cryptography,public-key-encryption
I've heard lots of public key theory, but I've never really understood how you can encrypt something that can be decrypted with a private key that you don't have. How does encrypting a message with a public key make it so that only the person with the corresponding private key...

How random is PHP pseudo random, of 4 bytes

php,hash,cryptography,crc32
I've been testing the randomness of generated values in PHP, and have been considering 32bit hexadecimal to represent a unique state within a given time frame. I wrote this simple test script: $checks = []; $i = 0; while (true) { $hash = hash('crc32b', openssl_random_pseudo_bytes(4)); echo $hash . PHP_EOL; if...

javax.crypto.BadPaddingException: pad block corrupted exception

java,encryption,cryptography,aes,bouncycastle
I get Exception in thread "main" javax.crypto.BadPaddingException: pad block corrupted at org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCipher$BufferedGenericBlockCipher.doFinal(Unknown Source) at org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCipher.engineDoFinal(Unknown Source) at javax.crypto.Cipher.doFinal(Cipher.java:2087) at Server.main(Server.java:67) when I'm trying to run an application between a Client and a Server. The Server class: public class Server { private static SecretKeySpec AES_Key; private static...

Ruby OpenSSL AES-128-CTR

ruby,openssl,cryptography,aes
I can't figure out what I am doing wrong here trying to decrypt a string of hex values with a given key using ruby's OpenSSL cipher AES-128-CTR. I am using the gem hex_string to convert my hex to bytes ctrkey = "36f18357be4dbd77f050515c73fcf9f2" ciphertext3 = "69dda8455c7dd4254bf353b773304eec0ec7702330098ce7f7520d1cbbb20fc3\ 88d1b0adb5054dbd7370849dbf0b88d393f252e764f1f5f7ad97ef79d59ce29f5f51eeca32eabedd9afa9329" cipher2 = OpenSSL::Cipher.new('AES-128-CTR') cipher2.decrypt...

Is it OK to encode data using key equal to data?

encryption,cryptography,aes
For some project, I need to store some short string in encrypted form. It would be ideal for the current purposes to encrypt it using itself. # This would be the usual way: result = AES_ENCRYPT(string, key) # but I would like to do it this way: result = AES_ENCRYPT(string,...

RSA decrypt message [closed]

c++,c,openssl,cryptography,rsa
My programs fails when I try to decrypt encrypted messages. My code: char *pri_key[] = "some key"; // ---> some key, that i've got from server RSA *rsa; BIO *keybio; keybio = BIO_new_mem_buf(pri_key, strlen(pri_key)); rsa = PEM_read_bio_RSAPrivateKey(keybio, &rsa, NULL, NULL); // Decrypt it // Encoded message is in buff char...

Node.js crypto key and iv to match java SecretKeySpec / IvParameterSpec

node.js,encryption,cryptography,aes,padding
I'm trying to to port a Java (simple) encryption algorythm to Node JS. I will need to be able to decrypt/encrypt stuff encrypted/decrypted from the Java side. I'm stuck at the very beginning, the initialization of the cipher. In Java, I get the key with SecretKeySpec, and the Initialization Vector...

SecKeyRawVerify verifies on mac but fails with -9809 on iOS

ios,osx,ssl,cryptography,commoncrypto
I need to digitally sign on mac some data and then verify it on iOS. So I generated RSA keypair and certificate for public key in DER format with open ssl (tried generation with SecKeyGeneratePair but then it is harder to import Public key to iOS and SecKeyRawVerify still doesn't...

Rijndael encrypted text causes length of data to decrypt is invalid error - C#

c#,exception,encryption,cryptography
I have searched online but have not been able to find any solutions to my problem. I am using previously written methods to encrypt and ecrypt text using the Rijndael class. I use these functions to encrypt and decrypt usernames and emails for a web application I have been working...

HMAC + SHA256 jwt secret length

hash,cryptography,jwt
I will be signing a token with SHA256 and I am wondering on the length of the secret I should put. Does having a secret key length over 256 bits have any benefits if I am using sha256. So if my key is 300 bits long is this more secure?

remotely stored password protected private key

encryption,cryptography,theory
I was wondering if there is a protocol for this. The idea is to have some encrypted data on a server. Now I would like to find a protocol that fulfills the following requirements. Since actively managing keys is beyond what most users are willing to put up with, a...

IllegalBlockSizeException in RSA encryption on Android only

java,android,encryption,cryptography
I'm currently working on an Java-Cyrpto-API which I want to include in an Android app later on. I tested every function of my Crypto-API and after all unit test succeeded I decided to include my jar into an Android project. In the project I started generating a 4096-bit key pair...

Fast bit shift of a byte array - CMAC subkeys

performance,cryptography,bit-manipulation,bit-shift,javacard
I need to implement as fast as possible left bit shift of a 16-byte array in JavaCard. I tried this code: private static final void rotateLeft(final byte[] output, final byte[] input) { short carry = 0; short i = (short) 16; do { --i; carry = (short)((input[i] << 1) |...

Recovering an ECPublicKey from Java to JavaCard

java,cryptography,javacard,apdu,elliptic-curve
This question is related to the one I asked yesterday : Recovering an ECPublicKey from JavaCard to Java I have the same problem but in the opposite way : After sending the public key from my card to my computer (the point is represented as an octet string in uncompressed...

Generate nonce c++

c++,openssl,cryptography,crypto++,nonce
I am wondering if there is a way to generate a Cryptographic Nonce using OpenSSL or Crypto++ libraries. Is there anything more to it than just generating a set of random bytes using autoseeded pools?

Does Commom Crypto library supports below key encapsulation RFC?

ios,cryptography,commoncrypto
I try to use below RFC algorithm in my app: https://tools.ietf.org/html/rfc5990 Bouncy Castle for c# and java supports it but I am working on iOS. As I know best tools for cryptography in ios is commoncrypto library. So the question is that whether this library supports it or not? I...

Symmetric and public key encryption

encryption,cryptography,key,encryption-symmetric,encryption-asymmetric
Suppose N people want to communicate with each of N- 1 other people using symmetric key encryption. All communication between any two people, i and j, is visible to all other people in this group of N, and no other person in this group should be able to decode their...

rfc2104 MD5 issue

c#,hash,cryptography,md5
Can someone give me an example in c# how to HASH string with MD5, regarding this document : http://www.ietf.org/rfc/rfc2104.txt I was used MD5CryptoServiceProvider but without success. I`m trying to communicate with external software and we must have same HASH. Asked their developers and they told me that use this alogirtm...

gcc; Aarch64; Armv8; enable crypto; -mcpu=cortex-a53+crypto

gcc,cryptography,arm64
I am trying to optimize an Arm processor (Corte-A53) with an Armv8 architecture for crypto purposes. The problem is that however the compiler accepts -mcpu=cortex-a53+crypto etc it doesn't change the output (I checked the assembly output). Changing mfpu, mcpu add futures like crypto or simd, it doesn't matter, it is...

How to add HMAC to CryptoJS AES encryption?

javascript,encryption,cryptography,aes,cryptojs
CryptoJS's convenience function CryptoJS.AES.encrypt("some plaintext", "password") doesn't seem to do any authentication. I see CryptoJS provides an HMAC class, but I'm confused about how to use this to encrypt-then-authenticate. I searched around for tutorials and other questions but couldn't find any. How would I add authentication using the above CryptoJS...

Crypto.VerifyHashedPassword throws exception

c#,asp.net,asp.net-mvc,asp.net-mvc-4,cryptography
I have hashed the user password using Crypto.HashPassword('nakedPassword'); and saved this value in my db. During signup: public Status Signup(Customer user) { //change password to password hash & create a verification codetry try { int pkid; user.PASSWORD = Crypto.HashPassword(user.PASSWORD); user.VER_CODE = Guid.NewGuid().ToString(); Mapper.CreateMap <Customer,user>(); var mappedcustomer = Mapper.Map<Customer,user>(user); string result...

Instructions for using Rabin Information Dispersal Algorithm (IDA)

cryptography,crypto++,instructions
I want to work on Rabin Information Dispersal Algorithm (IDA) using Crypto++ in Linux. A simple instruction can help me....

Concatenating MAC and salt with ciphertext

java,encryption,cryptography,aes,hmac
I've been having trouble adding a MAC to my password-based AES encryption/decryption program. I am trying to add the MAC'd plaintext and salt (to be used with password) (both byte arrays) to a final array along with the ciphertext, and then decrypt by reading in the ciphertext file and splitting...

Whats is the usage of SHA1 fingerprint in google map api

android,google-maps-api-3,google-api,cryptography,google-maps-android-api-2
What is the reason for add the SHA1 fingerprint in google api console?

Decrypting AES in Objective C

objective-c,encryption,cryptography,commoncrypto,rncryptor
I am new to encryption The problem: I am given a set of encrypted strings and I need to decrypt them to show to the mobile client user. For android, it decrypt fine and i am using the following method "decrypt". For iOS, I am having a lot of trouble...

How can I edit the list of cipher suite in Java using Bouncy Castle

java,ssl,cryptography,bouncycastle
The following code lists the supported cipher suites by Java SE 8: import java.io.IOException; import java.net.UnknownHostException; import java.util.Arrays; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLSocketFactory; public class ListCiphers { public static void main(String[] args) throws UnknownHostException, IOException { SSLSocketFactory factory = HttpsURLConnection.getDefaultSSLSocketFactory(); String[] cipherSuites = factory.getSupportedCipherSuites(); System.out.println(Arrays.toString(cipherSuites)); } //end main...

How can we create our own string encoding-decoding or encryption-decryption script in java without using any given library i.e. Base64, AES, etc?

java,security,encryption,encoding,cryptography
How can we create our own string encoding-decoding or encryption-decryption script in java without using any given library i.e. Base64, AES, etc? As per my client requirements, he want something where a user can decide a particular letter/number to be replaced by a letter/number which is again choosed by the...

Issues with AES Encryption using SynCrypto

delphi,encryption,cryptography,aes
Am trying to encrypt a file using SynCrypto.pas with AES 256, but it fails if I try to encrypt a file whose size is not a multiple of 16 bytes. The decrypted data contains junk. Example: Original string in txt file we are testing the file Encrypted String [ù[„|wáî}f *!4ìÙw¬•ü¨s...

salt vs. iv for PKCS5_PBKDF2_HMAC

c++,cryptography,crypto++
Understanding that PKCS5_PBKDF2_HMAC() requires a salt and gives back a derivedKey And that GCM<AES>::Encryption.SetKeyWithIV() requires an iv (along with the derivedKey) Is it safe to use the same value for salt (in PKCS5_PBKDF2_HMAC()) and iv (in GCM<AES>::Encryption.SetKeyWithIV()) - or should they be different?...

md5 hash a large file incrementally?

javascript,hash,md5,cryptography
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...

Hash Function to Generate 16 Alphanumerical Characters from Input String in C#

c#,hash,cryptography
I need a function that will receive an input string, regardless its length and will output a fix length of 16 characters of 0-9A-Z. The function should has same output if input by the same string. Any suggestion? Thanks ...

Issue matching PHP encryption to C#

c#,php,encryption,cryptography,rijndael
I have a C# application that implements encryption. I'm working on adding some functionality in PHP to work with this application. I use Rijndael Managed encryption in the application. I am able to decrypt a string in PHP no problem, but when I try to encrypt a string it doesn't...

AES encrypt/decrypt text

c++,algorithm,encryption,cryptography,aes
I have a text which contains email, username and password and I encrypt it using AES algorithm. It seems to be ok while I am encrypting, but when it goes to decrypting, only some part (fist 48bytes = 3x 16byte chunks) are ok, but the rest is just some garbage....

Generating and using two keys for encryption and decryption in Java

java,encryption,cryptography,des
I am working on a Java application which requires I use two keys generated from different Strings for encrypting and decrypting. One String is coming from user and other is master key. I looked on net and found a few references regarding it. I would really like some help in...

C# AES and RSA File Encryption - How to use IV?

c#,encryption,cryptography,aes,rsa
I'm writing a program at the moment that works under the following scenario: I've got some confidential log files that I need to backup to a server. I have a program that generates these log files every day. These log files would rarely if ever need to be opened. I...

vb.net AES decryption returns “data is incomplete block”

vb.net,encryption,cryptography,aes
I'm aware of the other thread on this issue (AES decryption error " The input data is not a complete block." Error vb.net), but I'm either not implementing the solutions offered there correctly, or something about my particular variant of this issue isn't covered by those solutions. In any event...

Stuck on reversing TripleDES in .NET

.net,cryptography,reverse-engineering,tripledes
I'm stuck on a target and I'm wondering to know is it possible to reverse this part of code, the goal is deal with 'nodeData' to get 'True' condition in 'result'. As i'm not familiar on this type of cryptography so I cannot understand this part of code. BTW I...

Efficient Three “Ships”, One Message Algorithm

algorithm,cryptography,redundancy,information-theory
The premise is that person 1 wants to send a secret message M (without key sharing) across the ocean to person 2. She decides to send partial messages via 3 ships such than if any two ships' versions get delivered person 2 can construct the complete original message. The goal...

Java Card DES generator applet output is different from online-tools output

java,cryptography,javacard
The below applet is written to do a DES encryption/Decryption on the APDU data field : package cryptoPack; import javacard.framework.APDU; import javacard.framework.Applet; import javacard.framework.ISO7816; import javacard.framework.ISOException; import javacard.framework.JCSystem; import javacard.framework.Util; import javacard.security.CryptoException; import javacard.security.DESKey; import javacard.security.KeyBuilder; import javacardx.crypto.Cipher; public class CryptoDES extends Applet { // Array for the encryption/decryption key...

PHP and Objective C Blowfish Encryption Encoding different

php,ios,encryption,cryptography,blowfish
The iOS and Android project I'm working on requires us to open a webview connecting to a 3rd party website. The problem is that the URL we call must be accompanied with some parameters encrypted using Blowfish with ECB mode. This 3rd party uses PHP to encrypt/decrypt the parameters and...

Java pow BigInteger implementation

java,cryptography,biginteger,pow,exponent
I am working on a cryptography implementation and part of the design includes the following: ( (y^a)^b / (y^c)^b ) mod p I have the following snippet: BigInteger yab = y.pow(ab.intValue()); BigInteger ycb = y.pow(cb.intValue()); BigInteger ans = (yab.divide(ycb)).mod(p); It works fine for small integer. Once I replaced it with...

Whats is the Java name for openssl's “aes-256-cfb”?

java,node.js,encryption,openssl,cryptography
I'm using openssl's aes-256-cfb algorithm (from NodeJS's crypto module). While both the NodeJS and the Java code successfully encrypt and decrypt data, the ciphertext is different, even when the iv, key and plaintext are all identical. openssl/NodeJS cipherText: 05c2aad7bac42ed0846e9a52ce73df9ff9d7ff914feea49fed27d55ad690782a43107914c1b307ec92753227728c95b8e59c546d Java cipherText: 05C2AAD7BAC42ED084739340D47CEC9F03D8E94AC7B1E11A56A6654F76AD2C8076BCA162303E39B44D043732E98FDD28C52D I have guessed that openssl's aes-256-cfb translates to...

How would I load a Private / Public Key from a string / byte array or any other container

c++,cryptography,rsa,public-key-encryption,crypto++
Is it possible to store a RSA Private/Public Key in the source for example in a byte[] or string or any other container and use this key for encryption / decryption? A decode function from file would look like: void Decode(const string& filename, BufferedTransformation& bt) { // http://www.cryptopp.com/docs/ref/class_file_source.html FileSource file(filename.c_str(),...

SQL-Server Verify SHA2_512 hash procedure

sql-server,tsql,encryption,cryptography,sha512
Consider this method declare @pswd nvarchar(max); set @pswd = '2YKRCqHv'; Select orig = a.Hash, hashA = 0x0200 + a.Salt + Hashbytes('SHA2_512', cast('2YKRCqHv' as varbinary(max)) + a.Salt), hashB = 0x0200 + a.Salt + Hashbytes('SHA2_512', cast(@pswd as varbinary(max)) + a.Salt) from DB a where a.Hash = 0x0200 + a.Salt+ Hashbytes('SHA2_512', cast('2YKRCqHv' as...

Segmentation fault with generating an RSA and saving in ASN.1/DER?

c,openssl,cryptography,rsa
#include <string.h> #include <openssl/aes.h> #include <openssl/rand.h> #include <openssl/bio.h> #include <openssl/rsa.h> #include <openssl/evp.h> #include <openssl/pem.h> #define RSA_LEN 2048 #define RSA_FACTOR 65537 int genRSA2048(unsigned char **pub,unsigned int *pub_l,unsigned char **priv,unsigned int *priv_l){ RSA *pRSA = NULL; pRSA = RSA_generate_key(RSA_LEN,RSA_FACTOR,NULL,NULL); if (pRSA){ pub_l = malloc(sizeof(pub_l)); *pub_l = i2d_RSAPublicKey(pRSA,pub); priv_l = malloc(sizeof(priv_l));...

AES vs PBEWithSHA256And256BitAES

java,encryption,cryptography,aes
I need to encrypt some data with a password. It has to be a variation of AES with a 256bit key. I searched a while on the web and came up with this two alogrithms. Now I do not know, which one to choose, cause I do not know, which...

c - Implementation of Rainbow table

c,table,cryptography,rainbowtable
Ok, so I'm trying to implement the online phase of a rainbow table attack on the GSM networks KASUMI cipher. Im not using the full 128 bit keyspace only 32 bit. Below is my implementation. I have generated a single rainbow table with 2^25 rows and 2^7.88 chains links for...

GnuPG for Java library ant build issue/bug

java,ant,cryptography,gnupg
I'm working GnuPG Java API to encrypt/decrypt files. Googled and found a Java Wrapper GnuPG for Java, Java wrapper for GPGME(GnuPG Made Easy,C language library). Official website also referring this as the Java wrapper. So followed the instructions, set up ant and tried to run ant clean release it is...