Decrypting Signed Message
dev-whoan opened this issue · comments
Hello, I have a question about opening a signed message.
I have generated a signed message with following code
LazySodiumJava lazySodium = new LazySodiumJava(new SodiumJava());
Sign.Lazy sign = (Sign.Lazy) lazySodium;
KeyPair keyPair = sign.cryptoSignKeypair();
System.out.println("Base58 Public Key: " + Base58.encode(keyPair.getPublicKey().getAsBytes()));
String signedMessage = sign.cryptoSign("hello world", keyPair.getSecretKey());
System.out.println("Hex string:" + signedMessage);
System.out.println("Signed message: " + Base58.encode(DatatypeConverter.parseHexBinary(signedMessage)));
and the example reulsts are
Hex string: DE35E9BB394EED2A91C895540A110744C18C3FDC470CA258A3D1B4502ACA59D9A01D6D6329BCFFC605A8040B14741838DCC37075D20B18D7DCF1BF3040C3390468656C6C6F20776F726C64
Signed message: 5s2ivW7rZXNcFnB4WG9aALmdfTJAdC96dAvsAtitNHH2zKaFY6CZQFCMZnmCrSBru7AAu3qqFzfybonw2DSYCJDrsJYSvu174SzizJo
And the both type of signed messages, hex string and base58 encoded, can be opened without public key.
Hex string is just decoded when I changed it into String type, and Base58 is just decoded by using Base58.decode.
The results are not clear (including some garbages), however I can see the original message.
I think both tries must not show the original message.
Is this a normal result?
Was just my misunderstood of the sodium java