cryptography

node.js - Simple TCP client/server example with aes256 encryption yields decrypt error & quirk

人走茶凉 提交于 2019-12-25 01:46:26
问题 Ahoy there! My first posting, be gentle! Windows 7 SrvPck 1, node v0.12.3, npm 2.9.1, aes256 cipher This is throwing me... it's also throwing a very basic error when I retrieve sample data from a client using TCP. My test configuration is on Windows 7 SrvPck 1 with node v0.12.3 and npm 2.9.1. My client/server are on the same Windows machine with port 5000 as the server. This inquiry is based on this posting which I found very informative - I'm new to node.js and crypto! Unfortunately I've

Spring MVC : On the fly encryption/decryption for 2 columns in db

狂风中的少年 提交于 2019-12-25 01:37:12
问题 I am working on a Spring-MVC application which uses Hibernate as the ORM and PostgreSQL as the database, in which I am looking for on-the-fly encryption decryption solution, but only for 2 columns in the database, the rest all can stay non-encrypted. I have a Person entity, which has a password and I am encrypting the password with BCrypt and saving them in database. If possible, I would like to use this password to encrypt/decrypt those 2 columns once the user logs in and does action on

Where is the trust chain? [python] asn1crypto and pkcs11 Aladdin USB eToken

我怕爱的太早我们不能终老 提交于 2019-12-24 23:42:57
问题 I have this code working fine. I am signing with an USB eToken. But after copying and pasting the PEM output of this code in the https://lapo.it/asn1js/ the trust chain is not shown. This eToken was provided by a CA and thus it has a trust chain of the signature. What's wrong? lib = pkcs11.lib('/usr/lib/libeToken.so.9') for slot in lib.get_slots(): try: token = slot.get_token() with token.open(user_pin='****') as session: priv = session.get_key(object_class=pkcs11.constants.ObjectClass

How to limit the maximmum length of the AES Encryption Password

杀马特。学长 韩版系。学妹 提交于 2019-12-24 22:53:17
问题 I would like to limit the length of the encrypted output code like 8 or 10 or 12 character etc. I have created the very small encrypted coed using he "Advanced Encryption Standard (AES)" with Cryptography.SymmetricAlgorithm.IV. But the result of the Encrypted code as example below: Input Password = "090400551" Converted Output = "mkopj3WFb6RZMp34urFLew==" // This should be half the length I want to reduce the length of 8 to 12 character. Any C# cryptography library or algorithm would be fine

Using PKCS 7 Cryptography

家住魔仙堡 提交于 2019-12-24 21:18:47
问题 I need to encrypt and sign data using PKCS7(CMS) . I am using bouncy castle provided api to achieve this using java . Till now what i understood is i need to follow these steps Need to generate a key pair private & public key using some algorithm say RSA Certify it with X509 certificate Convert it into PKCS7 key format like p7b Generate java key store using keytool some *.jks file Generate the Certificate Signing Request (CSR) using keytool command *.crt Become self CA(Certificate Autority)

How do I get ECDH keypair in Android 9.0 pie?

房东的猫 提交于 2019-12-24 20:45:50
问题 I want to get ECDH keypair (Public key and Private key). This method is not working in Android 9.0 pie, because Security provider "BC" , "SC" is removed from this version. I tried below method KeyPairGenerator keyGen = KeyPairGenerator.getInstance("EC", "BC"); SecureRandom random = SecureRandom.getInstance("SHA1PRNG"); keyGen.initialize(256, random); KeyFactory kaif = KeyFactory.getInstance("EC", "BC"); KeyPair pair = keyGen.generateKeyPair(); PrivateKey privateKey = pair.getPrivate();

PHP: Installing Libsodium to PHP v5.5

天大地大妈咪最大 提交于 2019-12-24 20:16:06
问题 How to correctly install Libsodium with PHP verson 5.5. I'm trying to follow the instruction on https://paragonie.com/book/pecl-libsodium/read/00-intro.md#installing-libsodium Here are the steps I did: Go to http://windows.php.net/downloads/pecl/releases/libsodium/1.0.6/ Download "php_libsodium-1.0.6-5.5-nts-vc11-x64.zip" and extract files. Copy "libsodium.dll" in my directory "C:\Program Files (x86)\PHP\v5.5" where is "php.exe" Copy "php_libsodium.dll" in my directory "C:\Program Files (x86)

How do I decrypt an AES key using C# Bouncy Castle that was encrypted using Libgcrypt raw flag

你离开我真会死。 提交于 2019-12-24 19:58:56
问题 Summary: I am attempting to decrypt (and eventually encrypt and return) files that are AES128 encrypted. The AES key is encrypted using libcrypt's RSA provider. When I attempt to decrypt the AESKey on Windows 7 using C# & BouncyCastle a "block truncated" error is thrown when I call "ProcessBlock". I have tried converting the data to BigEndian and I'll get a "Not a valid RSA exponent" when I try to create the RsaKeyParameters. The encryption was done using libgcrypt 1.2x on a linux system. I

How to write private key to password protected DER format in Java?

筅森魡賤 提交于 2019-12-24 19:08:52
问题 I have an RSA key pair that I generated in Java and I need to programmatically write the private key to the same format that openssl does when I run this command (and enter the appropriate data for the prompts, namely a passphrase to protect the private key): openssl req -out request.csr -newkey rsa:2048 -keyout privkeyfile The Java code to generate the key pair is pretty standard: KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA"); keyGen.initialize(2048); KeyPair keyPair = keyGen

Minimum key length of RSA

倖福魔咒の 提交于 2019-12-24 18:06:13
问题 When I implemented a license key mechanism in C# using RSA, I came across the RSACryptoServiceProvider class, which is limited to a minimum of 384 bit key size. This key length has direct impact on the signature (==license key) which I created. Is 384 bits a technical limit of RSA in general or might it be possible to implement RSA successfully with even shorter key sizes? Reading the (German) Wikipedia article which explains RSA, they use very small prime numbers in their mathematics