FAQ Database Discussion Community


Symmetric encryption (AES) in Apache Thrift

java,python,encryption,aes,thrift
I have two applications that interact using Thrift. They share the same secret key and I need to encrypt their messages. It makes sense to use symmetric algorithm (AES, for example), but I haven't found any library to do this. So I made a research and see following options: Use...

Bcrypt encryption in Symfony2

php,symfony2,encryption,bcrypt
I need to encrypt a string in Symfony using bcrypt. The string is not a password it's an API Key that will be saved in database as bcrypt hash. To do that I am doing simply $key = 'superSecretKey'; $options = array('cost' => 12); $hash = password_hash($key, PASSWORD_BCRYPT, $options) The...

Can I throw a message fault back to a WCF client from a routing service

c#,.net,web-services,wcf,encryption
My company has long used ASPX and windows services through a routing program to manage the connections and allow our datacenters to control where the clients make connections. Just recently we started using MVC and WCF. Yes in 2015 we are just moving to these things. Anyway they figured out...

AES encryption/decryption iOs and .Net

ios,objective-c,.net,encryption,aes
I used CocoaSecurity and RNCryptor to encrypt NSString on iOs app, and on the server side (.NET) tried to decrypt it using one of the many function found on the web, but no luck. Also AES decryption online tools, fail to decrypt. Can somebody provides a working example of NSString...

Mounting GEOM_ELI Encrypted ZFS Pool as root

unix,encryption,freebsd,boot,zfs
I have a 3 Disk RAIDz1 Pool, encrypted with AES128 in GEOM_ELI, that I have been using in FreeNAS since version 8. There have been many zpool upgrades, and over all I am very happy with ZFS. Lately however I have been growing frustrated with FreeNAS. Largely many bugs that...

Using Salt in AES in C# and PHP

c#,php,encryption,mono,aes
I'm trying to encode and decode a string using AES. At the moment, I'm encoding the string in Mono C# using the highest-rated answer here, because System.Security.Crytpography.Aes is not available in Mono. However, this implementation uses a Salt, and the PHP method I'm using to decrypt it does not take...

Partial support in VS 2013 for certificates and symmetric keys in azure v12

azure,encryption,visual-studio-2013,sql-azure
In a Visual Studio 2013 project targeting azure v12, I get SQL70015 errors (Statement x is not supported in the targeted platform) when creating key and certificate artifacts. However, before creating independent key and certificate objects in the project, I'd had a postdeploy script add them if they didn't exist....

JS: Decryption not possible after storing in database (SJCL)

javascript,ajax,encryption,sjcl
I'm experimenting with the Stanford Javascript Crypto Library (SJCL) and want to encrypt and later decrypt a string. The following code works fine: var pw = "password"; var message = "message"; var encrypted = sjcl.encrypt(pw, message); alert(encrypted); var decrypted = sjcl.decrypt(pw, encrypted) alert(decrypted); The first alert show the encrypted data...

How to decrypt using only ciphertext for NimbusDS?

java,json,encryption
I am using JWEObject(JWEHeader header, Payload payload) for encrypting. Is it possible to decrypt using only ciphertext? If so, how?

Translate JavaScript code of RSA encryption to Python

javascript,python,encryption,rsa
I have this JavaScript code to encrypt text using RSA, and I need one que generates the same encrypted message, but that works with Python. JavaScript code I'm using: var key = new RSAKeyPair( "2f9ac975a8a20c1b108e678904b42aa1", "", "4a5670127da1fd4e2a51685faff367f9" ); ... I'm having trouble finding an equivalent in Python because the parameter...

MemoryStream to String, and back to MemoryStream without adding any bytes (encodings, etc.)

c#,arrays,string,encryption
OK, I've come across some articles here and here, but they aren't doing quite what I need to do, and I'm running into some trouble. I am receiving an encrypted piece of data as a memorystream. I need to somehow write the memorystream to a file (the way I wrote...

Ways to encrypt a whole directory instead of just a file

encryption
I want to use GPG for local encryption only, and after reading the man file, I'm doing the following in order to encrypt a whole directory: I zip the directory with a password "zip -r -e foo foo", then I encrypt it with "gpg -c foo.zip" using a passphrase. Is...

How can we improve SSL handshake to increase the security?

security,ssl,encryption,server,cl
During SSL handshake, the server send the client its(server's) public key and then client creates a session key and encrypt it with the server's public key and send it to the server. The server then decrypt the message with its private key and retrive the session key. The further communication...

Decrypt file using GnuPG

encryption,gnupg
I am trying to decrypt a set of files with GnuPG, for which I already have the username and password. However, I cannot seem to be able to do so, even though I have generated a new key with the given credentials. When trying to run gpg --output result.sc --decrypt...

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...

searchable row level encryption using java?

java,database,security,encryption,bouncycastle
I am designing a java app that uses algorithms to import data from other sources into a database. And the app also searches for records in the database. How can I implement row level security in a way that the database does not even know that the data is encrypted,...

Part of Decrypt non-sense

java,android,encryption,aes
I am working a chat in android, here I am using the next methods for key generation, encrypt and decrypt messages. The problem is that when I send a message for example "hola" in the other side I get "holgAAAAAAAAAAAAAAA". Could you help to fix this?. private byte[] K; public...

How do I write Objects through a ObjectOutputStream, when the Objects are created in a different class?

java,encryption,inputstream,outputstream
I've tried to sum up my question, but really there's more behind it. For a task at uni we are supposed to create two constructors (English isn't my first language) 1) public SecureInputStream(InputStream base, OutputStream remote) 2) public SecureOutputStream(OutputStream base, InputStream remote) 1) is supposed to create BigIntegers g,n,k then...

Securing RTP packets without encrypting each packets

security,encryption,sip,voip,rtp
In VoIP, I understand encrypting SIP transmission will hide the information about what codec is used. Another way is encrypting the RTP payload, So transmitting SRTP/ZRTP in network. But encrypting each packet will take quiet a lot of processing in both end. I have seen few materials about scrambling RTP...

Getting variable encryption results with VB.Net and DES

vb.net,encryption,des
I'm working on an semi-internal encryption process for somewhat sensitive information. Email addresses and the like. I'm working with a few other developers at some sister companies on the project, and the requirements are that everyone's encryption can talk to everyone else's. We use a global password, encrypt and decrypt...

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...

Convert plaintext to perform elgamal encryption

java,encryption,elgamal
Hi i'm writing a program in java to test a variant of the elgamal encryption, however my problem is not the encryption/decryption chain itself, but how to perform the operations on the input given: a text file. I have a text file with some words in it (for example the...

iOS “Data Protection” depends on user passcode set or not?

ios,encryption,data-protection
When developing iOS Apps one can chose to add the Capability "Data Protection", which then offers more "protection". What, after a lot of searching and reading, is still unclear to me: will the files declared to be secured with "complete protection" be encrypted even if the user doesn't set a...

c++ convert hexadecimal string with “:” to original “binary” string

c++,encryption
I have the following code to convert an encrypted ciphertext to a readable hexadecimal format: std::string convertToReadable(std::string ciphertext) { std::stringstream outText; for(unsigned int i = 0; i < ciphertext.size(); i++ ) outText << std::hex << std::setw(2) << std::setfill('0') << (0xFF & static_cast<byte>(ciphertext[i])) << ":"; return outText.str(); } The readable result...

Trouble with for loops in Python 3: getting the index in string2 of an element from string1

python,python-3.x,encryption,indices,vigenere
I am trying to write a program that will take a file and encode it using the Viginère cipher. I've run into a little bump with indices. I've defined my strings text and alphabet like this: import string alphabet = string.ascii_lowercase ciphertext = open("black_hole.txt","r") ciphertext = ciphertext.read() text = ""...

why does my python code not encrypt or decrypt my message

python,encryption,caesar-cipher
For some reason when I run the code at the end it just displays the message without encrypting or decrypting it im really confused please do not hate on me if this is really obvious I am very new to python and barely know the basics #declare variables NewWord =""...

How to use AES CBC using a key longer than 256 bits in Python

python,encryption,aes
Anyone have a way to encrypt/decrypt using Python to handle AES in CBC mode with a key of 1024 bits (128 bytes)? All the AES pkgs found so far seem to be limited to 256 bit keys. My crypto background is limited....

How to migrate from sha256 encryption to bcrypt for php?

php,encryption
For Login : $rows = $sql->fetch(PDO::FETCH_ASSOC); $us_id = $rows['id']; $us_pass = $rows['password']; $us_salt = $rows['password_salt']; $status = $rows['attempt']; $saltedPass = hash('sha256', "{$password}{$this->passwordSalt}{$us_salt}"); For Register : $randomSalt = $this->rand_string(20); $saltedPass = hash('sha256', "{$password}{$this->passwordSalt}{$randomSalt}"); How can this sha256 encryption method be converted to bcrypt ?...

Encrypting (large) files in PHP with openSSL

php,file,encryption,aes,php-openssl
I'm trying to encrypt (big) files in PHP using AES and have looked into using Mcrypt and OpenSSL, the problem is all solutions I have found so far only encrypt strings, and the files I'm trying to encrypt would trigger the max memory limit for PHP (which unfortunately can't be...

Encryption of strings using AES 128 in Java/grails

java,grails,encryption,aes
I would like to encrypt 3 strings using AES 128 in Java / Grails, and using the code below, but i get the error "An error occurred when encrypting", can someone tell me what is wrong with my code, how to fix it. thanks in advance and to Stackoverflow. String...

Code fails for decrypting without salt or iv in Java

java,security,encryption,aes,password-encryption
I have a ciphertext and a 256-bit key to decrypt it, using AES. There is no salt or iv. I am using Java. I have implemented many of the solutions online, but they all use salts and input vectors. The following builds fine, but fails at runtime: "Salt not found."...

Migrating C# .Net encrypt/decrypt algorithm to Ruby

c#,ruby-on-rails,ruby,encryption,encryption-symmetric
I have to encrypt/decrypt data from a .Net based web service that is using the following code (based on Rijndael algorithm): /** * Cifra una cadena texto con el algoritmo de Rijndael * * @param plainMessage mensaje plano (sin cifrar) * @param p_strSpecialKey key especial * @return string texto cifrado...

LC3 assembly-unable to print the right character

assembly,encryption,lc3
I have been trying to make a program that decrypts a text that is being read from a file under the following condiditons: The adress of the first element of the file is 5001.Each letter is encrypted twice:The first time with Ceasar encryption and the second time with XOR encryption.The...

Difference between results with RSA Encryption with Bouncy Castle in Java and C#

java,c#,encryption,rsa,bouncycastle
I have a Java working sample app (which uses Bouncy Castle) that I need to port to C# (I'm using Bouncy Castle for C# too). The code is almost the same. However, even when I provide exactly the same modulus and exponent for both, the result arrays are completely different...

Java keystore maintenance utilities [closed]

java,ssl,encryption,keystore
We are using the below line in our shell script file : Djavax.net.ssl.trustStore="/proj/xxx/www/cgi-bin/xxx_cacerts The xxx_cacerts file contains SSL certificate information. As we are about to upgrade we tried changing that file as per the latest one given in our organization. For this we need to know what is "Java keystore...

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...

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,...

Receiving unexpected indent with encryption script [closed]

python,encryption
So I've been working on this script to just create a simple encrypted message and write the cipher text to a file. I keep getting an error for "unexpected indent" on line 32 and I can't figure out why. I've taken 2 pieces of code I found online and tried...

Encrypt string when passing it through url as hyperlink and decrypt to echo out on next page?

php,encryption
I am using the following encrypt and decrypt script so that when a user clicks on a link containing my string this gets encrypted in the url and decrypted on the next page. My string is being encrypted find but for some reason it won't decrypt on the next page....

Problems generating a self-signed 1024-bit X509Certificate2 using the RSA AES provider

c#,.net,ssl,encryption,x509certificate2
I am trying to generate an X509Certificate2 object using the Microsoft AES Cryptographic Provider: CALG_AES_256 (0x00006610) 256 bit AES. This algorithm is supported by the Microsoft AES Cryptographic Provider. My problem is that my call to CryptGenKey(providerContext, 0x6610, 0x4000001, out cryptKey) fails with the following error: An unhandled exception of...

Php encrypt url

php,apache,codeigniter,url,encryption
i need your help , i am using codeigniter php to do url encryption, i use default codeigniter encryption class , without changing the configuration, but when i encrypt the url show me error "Object Not found , the request url was not found on this server" the way i...

Why does node.js's crypto module give a different result than Java's Cipher class for AES encryption?

java,node.js,encryption,aes
I'm trying to understand why encrypted data changes when using Java or Node.js to encrypt it, I need to adapt node.js code to make it return exactly the same encrypted data that I have on Java. (Note that I cannot modify the java snippet) Node.js Implementation: var crypto = require('crypto');...

Digital Signature in java / android (RSA keys)

java,android,encryption,rsa,digital-signature
I would like to generate a digital signature in my java/android project with a private key(RSA) stored in DB. My 2 keys was generated with the below code (project is in production and I cannot change it): // Get keys pair (RSA) KeyPair rsaKyePair = createKeyPair(); // Get private/ public...

File security System in java? [on hold]

java,file,security,encryption
i'm new to java world.I have a idea about file secure system.When i add a file to the application it will encrypt and store a folder in the installation path.If i need to see the file ,i need to login with my username and password and the file will automatically...

Error with encrypt message with RSA python

python,python-3.x,encryption,rsa
Use the sample code to encrypt a message using the RSA, but I get the following error. Traceback (most recent call last): File "E:/PythonProjects/skypy/skypy/codebase/utils/crypto.py", line 32, in <module> print(RSAPubKey.encrypt("Hello.", 32)) File "E:\Programs\Python3.4\lib\site-packages\Crypto\PublicKey\RSA.py", line 150, in encrypt return pubkey.pubkey.encrypt(self, plaintext, K) File "E:\Programs\Python3.4\lib\site-packages\Crypto\PublicKey\pubkey.py", line 75, in encrypt ciphertext=self._encrypt(plaintext, K) File...

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...

MySQL AES_DECRYPT wrong/strange result

mysql,encryption,aes
Under my development machine WAMP, AES_ENCRYPT and AES_DECRYPT is not working as required, also i tested with ENCODE and DECODE and same happen... I'm not understading why... SELECT AES_ENCRYPT('text', SHA1('My secret passphrase')) as enc, AES_DECRYPT(AES_ENCRYPT('text', SHA1('My secret passphrase')), SHA1('My secret passphrase')) as denc Result: enc : 3278167d9d630327c74d83067964c9b6 denc: 74657874 text...

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...

Encrypt AES key?

encryption,aes
Consider this scenario: Key1 = random key Key2 = random key CombinedKey = Key1.encrypt (Key2) Input = "test" Step1 = CombinedKey.encrypt (Input) Step2 = key2.decrypt (step1) Result = key1.decrypt (step2) Is Result == "test" if the encryption type is AES? Or for any other encryption algorythm?...

AES with PKCS#5 padding

java,encryption,aes,bouncycastle,jce
In quite a few places, I see Java code that uses AES with PKCS#5 padding. I do not understand how this could possible work. PKCS#5 padding is meant to be used with ciphers that have a block size of <= 8 bytes. The block size for AES is 16 bytes....

Reverse ^ operator for decryption

c,algorithm,security,math,encryption
I'm trying to reverse the following code in order to provide a function which takes the buffer and decrypts it. void crypt_buffer(unsigned char *buffer, size_t size, char *key) { size_t i; int j; j = 0; for(i = 0; i < size; i++) { if(j >= KEY_SIZE) j = 0;...

iOS - Password Encryption in Swift

php,ios,swift,encryption,passwords
I need to encrypt a password in Swift and send it to my web server to store in the database. Any best practices? I've seen AESCrypt.encrypt(userPassword, password: API_AUTH_PASSWORD) but I'm not really sure if this is sufficient (salted, etc.). Also, on the server itself, how would I go about comparing...

How to get file type from encrypted file?

c#,encryption,caesar-cipher
How do I get the file type using C# from an encrypted file (i.e. file.enc)? Encryption Method: Shift Cipher Z256 Shift Cipher Encryption: Yi = (Xi + k) % 256 Xi = (Yi - k) % 256 Where: Xi, i = 1 : n, is the input in plain bytes....

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...

AES 256 and Base64 Encrypted string works on iOS 8 but truncated on iOS 7

php,ios,encryption,aes
One of my app needs to download a database with the content encrypted in AES 256. So I've used on server side phpAES to encode the strings in AES CBC with an IV. On the iOS side I'm using FBEncryptor to decrypt the string. This is the code on the...

SSL/TLS: Why will the server be the only one to be able to decrypt the encrypted number if it's a public key?

ssl,encryption
Wouldn't anyone else be able to decrypt it too using the public key? Or is it saying that it will be decrypted with a private key. If that's the case how could something be encrypted with one key and decrypted with another? This is in reference to this wikipedia article....

(Android) Encrypting data disallowing awarness of the method used in the source code

java,android,encryption
I'm currently helping on a project in which some data must be encrypted using some symmetric algorithm (a second level of encryption above the SSL/TLS connection which is currently implemented). The problem is that if we extract the source code from the .apk (using tools like ApkTool, dex2jar & Java...

Why is it impossible to implement an “infinite” one time pad algorithm?

encryption,encryption-symmetric
I've done some research into this, but I'm still not sure why this cannot be implemented. Provided we share an initial OTP, possibly via USB or some other physically secure method, surely we can include the next one in the messages that follow. [Edit: More specifically, if I were to...

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...

Get RSA keys in a “simple” form

c++,c,encryption,openssl,rsa
How can I get keys generated by OpenSSL in RAW form? I mean I can't decode my encoded messages in any of online tools. What actions should I do to distribute my keys to other clients (in other apps and web-apps) in proper forms? My generation code is: void VS_CarrierNet::generateKeys()...

Implement same RSA encryption on iOS and Android

android,ios,encryption,rsa
I have iOS sources for data encoding and I try to implement same encoding in Android app. iOS sources: - (NSString *)encryptRSA:(NSString *)plainTextString useKeyWithTag:(NSString *)tag withSecPadding:(SecPadding)padding { SecKeyRef publicKey = [self _getPublicKeyRefByTag:tag]; size_t cipherBufferSize = SecKeyGetBlockSize(publicKey); uint8_t *cipherBuffer = malloc(cipherBufferSize); uint8_t *nonce = (uint8_t *)[plainTextString UTF8String]; SecKeyEncrypt(publicKey, padding, nonce, strlen(...

RSA encryption in Android and Java

java,android,security,encryption,rsa
I would like to encrypt a String with RSA encryption. My public/private keys were generated and stored in DB. In android, I use this code: public static String encryptRSAToString(String text, String strPublicKey) { byte[] cipherText = null; String strEncryInfoData=""; try { KeyFactory keyFac = KeyFactory.getInstance("RSA"); KeySpec keySpec = new X509EncodedKeySpec(Base64.decode(strPublicKey.trim().getBytes(),...

Encryption of message in client and server communication

php,encryption,https,client-server
How to encrypt the text travelling between client and server in the following code. I am aware that https will encrypt the tunnel but I want to know how to encrypt the text. if I use any algorithm of encrytion at the script, being server side script, the encryption will...

Decrypt an encrypted text

c#,encryption
I got a textbox and a 'decrypt' button in my Windows Form Application where I put an encrypted string in there and try to decrypt it but the problem is this. First, I got this class code called DataEncryptor from a guy on this website: public class DataEncryptor { TripleDESCryptoServiceProvider...

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...

can not insert MCRYPT encrypted data to the database

php,mysql,encryption,pdo,mcrypt
I'm using MCRYPT to encrypt sensitive data and save them to the database. The encrypted data look like this (non-encrypted data above the encrypted data) then insert to the MySQL PDO database as usual in a text field utf8_unicode_ci but the result is empty most of the times. Sometimes it...

Encrypted Querystring in URL getting changed to lowercase in Outlook

c#,asp.net,email,url,encryption
I am providing a CANCEL button in a registration email, so that the user can click the link and cancel their registration. This works fine except Outlook is converting links to lowercase. So when the user clicks the link, I can't decrypt the URL because the encrypted querystring is now...

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...

AES encryption differences between php mcrypt and a Delphi component

php,delphi,encryption
I am using a Delphi component from chillkat which does AES encryption for me. It works like a charm and the server accepts my encrypted requests. So I tried to create a php pendant by using mcrypt. But the PHP mcypt result is different in comparison with the Delphi Chillcat...

Decrypt strings encrypted with a SecretKey, when the key is no longer accessible

android,encryption
I have an interesting situation here. My app stores sensitive info input by the user such as a social service account of theirs. I use a master password input by the user to generate a SecretKey, and then use AES encryption and store its SHA1 hash and the encrypted data...

Issue with understanding keystore and ssl

java,android,ssl,encryption
These are the facts: I have a client(android)-server(java - Ubuntu 14.04)-program with which I transmit my gps-data from my smartphone every 5 minutes to the server saving it into a mysql-database. My problem is that I do not want to transmit my GPS data plain. So I want to use...

Can I specify the nonce and counter in AES encryption counter mode?

encryption,aes,crypto++
I'm trying to use the library Crypto++ to make AES Counter mode based encryption/decryption I want to split the IV value into nonce and counter. Is there any API that directly takes the nonce and counter to construct the IV ? I did the following to achieve it byte counter[AES::BLOCKSIZE/2]...

Why do my “random” MachineKey's Validation Key and Decryption Key both start with the same bytes?

c#,asp.net,encryption,machinekey,.net-4.5.2
I have an MVC app using .NET 4.5.2. In this app, I set the MachineKey as follows: <machineKey compatibilityMode="Framework45" validationKey="25E5749C117E4072E721DA0B8A88B052AAA821CA1D1638C10F0DBF528C19D296134A996B5FA934E1032C9BA9FBDC45EF8806153D683EF4F6C833E7BF6639C513" decryptionKey="DC7ACBAD80BC8EDBD1429F102CEC1C210604DA6C3E6421A4" validation="SHA1" decryption="AES" /> I then run my GetMachineKey code (which has a dependency on ReflectionMagic to keep the reflection code simple when accessing Internal properties): public static...

Android encryption and decryption of text fails

android,security,encryption,encryption-symmetric
I try to encrypt some text (here it is named code) and decrypt it again. For this i use a 4 digit Pin which is salted. After this the text is encrypted, also again some Base64 decoding, so i can safely output the String again. As i understand i have...

rails saml how to decrypt xml?

ruby-on-rails,xml,ruby-on-rails-4,encryption,saml
I'm doing an SAML AUTHENTIFICATION, and when I received the xml, a part of it is ecrypted. This is the part I need (contains name, email etc.) For that I have a private key to decrypt it, but I don't have any idea how to do that. I am here:...

How to customize the output of the Postgres Pseudo Encrypt function?

postgresql,encryption
I would like to use the pseudo_encrypt function mentioned a few times on StackOverflow to make my IDs look more random: https://wiki.postgresql.org/wiki/Pseudo_encrypt How can I customize this to output unique "random" numbers for just me. I read somewhere that you can just change the 1366.0 constant, but I don't want...

GnuPG error version 2.0.14

encryption,gnupg
When i try to encrypt a file using GnuPG the -----BEGIN PGP MESSAGE----- is added but in the same file the -----END PGP MESSAGE----- is not added in the encrypted file using a java program. When the number of files processed is more this error is noticed. This results in...

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...

AES-functions always reply with empty results

.net,vb.net,encryption,aes,rijndael
today I've got a question about my current Visual Basic project I'm going for. My intention is to serve one or more encrypted Configuration-files for my program in the same directory where the executable is placed in. Because most likely the (en/de)cryption will be processed twice (username and password), I...

What are the different ways of generating a key for encription

php,encryption,aes,symmetric-key
I am using aes256 with php to encrypt data. In the various documents I see various ways to generate a key, Like: $key = pack('H*', "bcb04b7e103a0cd8b54763051cef08bc55abe029fdebae5e1d417e2ffb2a00a3"); Or $Key = "what ever, plain string"; Or $Key = "123456789abcdef";//128bit What is the point of the first example, as opposed to the others?...

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...

Handling Confidential Data in web application

asp.net,sql-server,encryption,pbkdf2,tde
I want to handle some confidential data in one of my web application. So that the data shouldn't able to read by the Developer or Database administrator. We can easily hide the data from DB administrator by implementing some encryption technique. But still the developer can see the data since...

DES decryption only working when the key is 0s

c#,encryption,des
I'm experiencing a weird behaviour here. Whenever I set the DES key to 0s the decryption works, but if I set the key to anything else then the decryption returns an unreadable string: Main method: static void Main(string[] args) { //Decryption works! byte[] key0 = new byte[] { 0x00, 0x00,...

Encrypt file in python with aes

python,encryption,aes
I want to encrypt and decrypt a file (any type of file) using aes 128 in cbc mode in python. I am quite new to cryptography and i have tried some tutorials but all work only on texts, and i need it for files. Could anyone suggest me a solution?...

Secure downloaded Files in android applications with internal storage and encrypting usage?

android,encryption,android-contentprovider,internal-storage
I am working on an Android application which downloads files in External storage. I want to download them in internal storage and encrypt them so they become secure even with a rooted device. I found that we can work with internal storage and encrypting the files and to use them...

gzip and pipe to output (performance consideration)

linux,unix,encryption,gzip,solaris
q1) Can i check if I do a gzip -c file | encrypt (some parameters) a) does gzip print out the output line by line and pipe it to the encrypt function or b) gzip will be perform 1st, then the output will be pipe all at once to the...

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...

Cipher text in C,How to repeat key characters

c,encryption,vigenere
Explanation The ciphertext is generated from the plaintext by “adding” corresponding characters of the plaintext and the key together. If the plaintext is shorter than the key, only some of the key will be used. Similarly, if the plaintext is shorter than the key, the key will be used...

OutOfMemoryException while decrypting file using facebook conceal

java,android,facebook,encryption,facebook-conceal
I'm working on android application where I need to save Videos in SD Card which must not be transferable that's why I'm encrypting and decrypting as and when needed with Facebook Conceal which works perfectly fine if video size is smaller. Whenever I tries to do encryption and decryption to...

Encryption in Realm gives java.lang.IllegalStateException: Wrong key used to decrypt Realm

android,encryption,realm
I am using Encryption in Realm for inserting data into database. I have to insert data into different tables, and tried to encrypt the data in tables. But i just got java.lang.IllegalStateException: Wrong key used to decrypt Realm. My Codes: DatabaseHandlerRealm.java public class DatabaseHandlerRealm { private Realm realm; byte[] key,...

How to securely pass data from php forms to html

javascript,php,html,security,encryption
I have a login system which is an html form and I need to send the username and password back to the php backend where I can there securely encrypt it and store it in a database. I was wondering what the most up to date and secure method of...

DES encrypted value mismatching android and ios

ios,objective-c,iphone,encryption
IOS code is #import "DESCodec.h" #import <CommonCrypto/CommonCryptor.h> @implementation DESCodec { NSString *key; } -(id) init{ self=[super init]; if(self){ key=@"12345678"; } return self; } -(NSString *) decode:(NSString *)encoded{ NSData *inputData = [[NSData alloc] initWithBase64EncodedString:encoded options:0]; NSData *keyData = [key dataUsingEncoding:NSUTF8StringEncoding]; size_t outLength; NSMutableData *outputData = [NSMutableData dataWithLength:(inputData.length + kCCBlockSizeDES)]; CCCryptorStatus result...

AES Encryption in Java differs from PHP

java,php,encryption
Frequent visitor but first-time poster. I've been doing much searching but can't find an adequate explanation for why this: public class encryption_test { private static final String text_encoding = "UTF-8"; private byte [] byte_array (String input) throws Exception { return input.getBytes (text_encoding); }// byte_array; private byte [] encrypt (String text)...

What is the encryption strength if I don't know the encryption method and parameters?

encryption
If I use different encryption methods but provide no indication in the ciphertext output of which method I use (for example, attaching an unencrypted header to the ciphertext) does that make the ciphertext harder to decrypt than just the difficulty implied by, for example, the keylength? The lack of information...

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 =...

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,...

WMI Code Creator for Bitlocker Status - where did i go wrong?

c#,encryption,wmi
I am working with the WMI Code Creator and the code looks to work properly from the app. HOWEVER, It comes up with errors internal of my code that I cant seem to shake. Am I supposed to have a reference for this to work? if so where can I...

How to decrypt identity section in web config?

asp.net,encryption
I have the following encrypted identity tag in my web config file-: <identity configProtectionProvider="RsaProtectedConfigurationProvider"> <EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element" xmlns="http://www.w3.org/2001/04/xmlenc#"> <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/> <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#"> <EncryptedKey xmlns="http://www.w3.org/2001/04/xmlenc#"> <EncryptionMethod...

How to generate a md5 hash for an htpasswd file in PHP when I don't have the plaintext

php,linux,apache,encryption,hash
I have records in my database for users passwords encrypted with md5. I'd like to have PHP add those encrypted passwords to the htpasswd file. But I've read that the htpasswd file uses an MD5 algorithm that is repeated 1000 times and salted. I've found plenty of examples online for...

Attempting to use SHA1 hashing to send password to Google

c#,encryption,sha1,google-directory-api
I am currently working on a program with Google's Directory API to reset the password of someone in my domain. I have it all working, but I would like to send an encrypted password to Google instead of plaintext. Since the API seems limited in what I can use to...