<p>Here is the quote you're referring to (<a href="https://code.google.com/p/bitcoinj/source/browse/core/src/main/java/com/google/bitcoin/core/ECKey.java" rel="nofollow">link</a>)</p>

<pre><code>/**
 * &lt;p&gt;Represents an elliptic curve public and (optionally) private key, usable for digital signatures but not encryption.
 * Creating a new ECKey with the empty constructor will generate a new random keypair. Other constructors can be used
 * when you already have the public or private parts. If you create a key with only the public part, you can check
 * signatures but not create them.&lt;/p&gt;
 *
 * &lt;p&gt;ECKey also provides access to Bitcoin-Qt compatible text message signing, as accessible via the UI or JSON-RPC.
 * This is slightly different to signing raw bytes - if you want to sign your own data and it won't be exposed as
 * text to people, you don't want to use this. If in doubt, ask on the mailing list.&lt;/p&gt;
 *
 * &lt;p&gt;The ECDSA algorithm supports &lt;i&gt;key recovery&lt;/i&gt; in which a signature plus a couple of discriminator bits can
 * be reversed to find the public key used to calculate it. This can be convenient when you have a message and a
 * signature and want to find out who signed it, rather than requiring the user to provide the expected identity.&lt;/p&gt;
 */
</code></pre>

<p>This library implements ECDSA is Elliptic Curve Digital <strong>Signature</strong> Algorithm, hence you can only sign/verify with this algorithm. 
ECDH is Elliptic Curve Diffie Hellman and can be used to share a secret 
key between two parties. </p>

<p>ECIES is Integrated Encryption Scheme which mix EC and AES, but it is 
not implemented in OpenSSL (the core Bitcoin crypto library) nor the one you reference. </p>

<p>More details on these algorithms on wikipedia ;) </p>

<p>In conclusion, with ECDSA you can only sign/verify, you may encrypt 
mixing ECDH to generate keys and AES to do symmetric encryption (even at 
command line: look at ecparam, ecdh, enc), or you may use ECIES but you 
need a different library. </p>

<p>On a related note, <a href="https://bitcointalk.org/index.php?topic=196378.0" rel="nofollow">this guy seems to have</a> re-invented ElGamal encryption using ECDSA but I haven't looked into his code at all.</p>

CC BY-SA 3.0
2014-02-10T18:54:03.663Z
2014-02-10T18:54:03.663Z
makerofthings7
<p>As far as I know, the only issue is the different encoding schemes for ECDSA and ECC. It might take some effort to get thru the specs to determine what byte sequences mean what, but in general if it is difficult to derive the private key from the public key, then you can use the key-pair for either signatures or encryption. If one system is insecure, the other is.</p>

CC BY-SA 3.0
2014-01-11T07:00:17.810Z
2014-01-11T07:00:17.810Z
Woozer
<p>I came across this in the source code for ECKey.java:</p>

<p>"Represents an elliptic curve public and (optionally) private key, usable for digital signatures <strong>but not encryption</strong>."</p>

<p>Why can you not encrypt with it? It would be useful to be able to do that, for instance you could write a message to someone that only they can read. Is it a fundamental problem or simply a matter of man hours to implement it? (I'm happy to write it if it's possible.)</p>

<encryption><bitcoinj>
BitcoinJ encrypt message
Carlos
# BitcoinJ encrypt message

(Asked by: username_0 on 2013-11-21)

I came across this in the source code for ECKey.java:

"Represents an elliptic curve public and (optionally) private key, usable for digital signatures **but not encryption**."

Why can you not encrypt with it? It would be useful to be able to do that, for instance you could write a message to someone that only they can read. Is it a fundamental problem or simply a matter of man hours to implement it? (I'm happy to write it if it's possible.)

**Tags:** encryption, bitcoinj


---

## 2 answers

### Answer by username_1 on 2014-02-10. Score: 1

Here is the quote you're referring to ([link](https://code.google.com/p/bitcoinj/source/browse/core/src/main/java/com/google/bitcoin/core/ECKey.java))

```
/**
 * <p>Represents an elliptic curve public and (optionally) private key, usable for digital signatures but not encryption.
 * Creating a new ECKey with the empty constructor will generate a new random keypair. Other constructors can be used
 * when you already have the public or private parts. If you create a key with only the public part, you can check
 * signatures but not create them.</p>
 *
 * <p>ECKey also provides access to Bitcoin-Qt compatible text message signing, as accessible via the UI or JSON-RPC.
 * This is slightly different to signing raw bytes - if you want to sign your own data and it won't be exposed as
 * text to people, you don't want to use this. If in doubt, ask on the mailing list.</p>
 *
 * <p>The ECDSA algorithm supports <i>key recovery</i> in which a signature plus a couple of discriminator bits can
 * be reversed to find the public key used to calculate it. This can be convenient when you have a message and a
 * signature and want to find out who signed it, rather than requiring the user to provide the expected identity.</p>
 */

```

This library implements ECDSA is Elliptic Curve Digital **Signature** Algorithm, hence you can only sign/verify with this algorithm.
ECDH is Elliptic Curve Diffie Hellman and can be used to share a secret
key between two parties.

ECIES is Integrated Encryption Scheme which mix EC and AES, but it is
not implemented in OpenSSL (the core Bitcoin crypto library) nor the one you reference.

More details on these algorithms on wikipedia ;)

In conclusion, with ECDSA you can only sign/verify, you may encrypt
mixing ECDH to generate keys and AES to do symmetric encryption (even at
command line: look at ecparam, ecdh, enc), or you may use ECIES but you
need a different library.

On a related note, [this guy seems to have](https://bitcointalk.org/index.php?topic=196378.0) re-invented ElGamal encryption using ECDSA but I haven't looked into his code at all.


---

### Answer by username_2 on 2014-01-11. Score: 0

As far as I know, the only issue is the different encoding schemes for ECDSA and ECC. It might take some effort to get thru the specs to determine what byte sequences mean what, but in general if it is difficult to derive the private key from the public key, then you can use the key-pair for either signatures or encryption. If one system is insecure, the other is.


---

