Posts

Showing posts with the label encryption

How to encrypt/decrypt a data using Elliptic Curve Cryptography(ECC) using the Bouncy Castle Open Source Library for iOS Swift

Image
Clash Royale CLAN TAG #URR8PPP How to encrypt/decrypt a data using Elliptic Curve Cryptography(ECC) using the Bouncy Castle Open Source Library for iOS Swift How can I encrypt and decrypt a data using Elliptic Curve Cryptography(ECC) using the Bouncy Castle or Spongy Castle Open Source Library for iOS Swift. You can try cryptoSwift library for encryption/decryption. github.com/krzyzanowskim/CryptoSwift – Smita Dec 27 '17 at 10:28 CryptoSwift not supporting Elliptical Curve Encryptions – Ajithkumar M Dec 27 '17 at 10:48 Bouncycastle is for Java and c#, not for iOS – pedrofb ...

Image Encryption in Swift

Image
Clash Royale CLAN TAG #URR8PPP Image Encryption in Swift I am using IDZSwiftCommonCrypto for image encryption using StreamCryptor described as an example at its GitHub page: https://github.com/iosdevzone/IDZSwiftCommonCrypto IDZSwiftCommonCrypto I am not able to successfully decrypt. Here is my code for encryption and decryption (imageData comes from UIImageView ). The output is different from input after encryption (imageData is different from xx). UIImageView Encryption: func performImageEncryption(imageData: Data) -> Void { var inputStream = InputStream(data: imageData) let key = arrayFrom(hexString: "2b7e151628aed2a6abf7158809cf4f3c") var sc = StreamCryptor(operation:.encrypt, algorithm:.aes, options:.PKCS7Padding, key:key, iv:Array<UInt8>()) var inputBuffer = Array<UInt8>(repeating:0, count:1024) var outputBuffer = Array<UInt8>(repeating:0, count:1024) inputStream.open() var cryptedBytes = 0 ...

Use openssl_decrypt() with passphase (not key/iv)

Image
Clash Royale CLAN TAG #URR8PPP Use openssl_decrypt() with passphase (not key/iv) I'm trying to decrypt some data that has been encrypted with a passphrase and aes-256-cbc method in a PHP script. aes-256-cbc Here is how I encrypt the original data printf "Hello" | openssl enc -e -base64 -A -aes-256-cbc -k "MYPASSWORD" // output U2FsdGVkX1+dWuBuiitifH4zu1Yv/l7+HcfIqR/wxSc= When I try to decrypt it in command-line it works fine printf "U2FsdGVkX1+dWuBuiitifH4zu1Yv/l7+HcfIqR/wxSc=" | openssl enc -d -base64 -A -aes-256-cbc -k "MYPASSWORD" // output Hello BUT when I use openssl_decrypt() in my PHP script it doesn't work!! $result = openssl_decrypt("U2FsdGVkX1+dWuBuiitifH4zu1Yv/l7+HcfIqR/wxSc=", 'AES-256-CBC', "MYPASSWORD"); var_dump($result); //output bool(false) I append the following lines to get the error while ($msg = openssl_error_string()) echo $msg . "<br />n"; And it returns: error:0...

Why its impossible to find private key with the public key

Why its impossible to find private key with the public key Based on this article: https://medium.com/coinmonks/private-and-public-key-cryptography-explained-simply-4c374d371736 For what I understand in the article, the public key is generated by performing `n' tangent + mirroring operations from G point (having G point defined at secp256k1 and begin n a natural number that directly relates to the private key) My question is: as I know the public key and the seed value `G', I could start a process computing G·G, G·G·G, and comparing those results with the public key value until it matches. If your answer would be that this process is very slow I have another question: If this process is slow, the same applies to, knowing the private key, and compute the public key (Because the operations are the same except for the check operation), so how it is possible to compute the public key in a very fast way? By clicking ...