title: Using ECC Curve25519 to encrypt/decrypt data in Java
body: <p>I am trying to use Curve25519 in my Android app to encrypt/decrypt AES encryption key locally. I don't need any key exchange, key agreement or signing. Why I need to use that particular curve? Because I need to be able to provide private key myself and be able to calculate it's matching public key. So as far as I got, only Curve25519 does this. Please correct me if I am wrong.</p>
  
  <p>All Curve25519 implementations just do key generation, key exchange and signing/verifying. </p>
  
  <p>Is it possible to do data encryption/decryption after I get Curve25519 private/public keys or maybe you can suggest any alternative curves that matches my criteria?</p>
  
  <p><strong>Edit</strong></p>
  
  <p>So why I need this? I'll explain more carefully. My app is doing local file encryption, particularly photos. My goal is to be able for user to take a photo without entering a password and then enter password to view them.
  For this I need to be able to create public/private keypair from password and be able to recreate on the fly the same keypair whenever same password is provided. So on first run I generate ECC keypair from password and store public key on the device. When user wants to take a new photo app encrypts photo with random 256 bit AES key and then encrypt that key with stored public key. When user wants to view photo, he/she provides correct password, I derive same ECC keypair and decrypt AES key with my private key and then I can decrypt the photo using AES 256.</p>
  
  <p>So as far as I get Curve25519 can give me this ability or there are any other alternatives. Code examples in Java are welcomed!</p>