It`s going well. 🙂 Note that for various reasons, it is not advisable to use the common secret key directly as a symmetrical key. While the derivative secret cannot be distinguished from an element chosen at random from all possible outcomes of the elliptical curve group, it is not the same as an equally random string of bits. Considered a string of bits, it will have some structure. In other words, the P-256 curve offers about the same security as a 128-bit secret key, but the common secret key for output is 256 bits. This shows that common secrecy doesn`t really provide 256 bits of “random” key data. There are other reasons not to use the common secret key directly, depending on usage. In the “Safety Considerations” section of RFC 7748, for example, it is recommended to deduct a key from the common secret key plus the two public keys, if we intend to use the key for authentication (this RFC uses different curves than the ones we use here, but that`s good advice, regardless of that: use the example, compile and then run two instances of this key (maybe on different computers). An ephemeral public key value is printed in hex-coded, and then the public key of the other instance is waited. Simply copy these values from one to the other (and vice versa) and then the calculated common secret is printed again hex-coded and finally a secret key of the common secret.
If I use the algorithm above, the error below There are a number of complete protocols that rely on this basic tuning mechanism, adding authentication and other details: How can I remove this exception? java.lang.SecurityException: no manifest section for signature file entry org/bouncycastle/jce/provider/JDKMessageDigest$RIPEMD256.class at sun.security.util.SignatureFileVerifier.verifys (SignatureFileVerifier.java:608) at sun.security.util.SignatureFileVerifier.verifys (SignatureFileVerifier.java:608) at sun.security.util.SignatureFile.. processImpl (SignatureFileVerifier.java:341) at sun.security.util.SignatureFileVerifier.process (SignatureFileVerifier.java:263) at java.util.jar.JarVerifier.processEntry (JarVerifier.java:275) at java.utilifier.jar.JarVerVerEntry