elective-stereophonic
elective-stereophonic
Encrypted Messages singapore
Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest Stable Nxt Client: Nxt 1.12.1 Upgrade before block 2870000 is mandatory!

Pages: [1] 2 3 ... 14  All

Author Topic: Encrypted Messages  (Read 48256 times)

Eadeqa

  • Hero Member
  • *****
  • Karma: +83/-68
  • Offline Offline
  • Posts: 1888
    • View Profile
Encrypted Messages
« on: March 31, 2014, 07:58:23 pm »

A few clients now do encrypted messages.

Are these encrypted messaging system compatible among various clients?

For example, if someone using NxtSolaris sends an encrypted message to a user using OffSpring, is OffSpring user able to decrypt it and respond?

 I hope there is just one standard that all clients use.
Logged
NXT-GZYP-FMRT-FQ9K-3YQGS

Graviton

  • Sr. Member
  • ****
  • Karma: +62/-30
  • Offline Offline
  • Posts: 297
    • View Profile
    • DGEX
Re: Encrypted Messages
« Reply #1 on: March 31, 2014, 08:00:04 pm »

Are these encrypted messaging system compatible among various clients?

I do think so. Need to try that out soon.
Logged
* dgex.com operator * nextcoin.org founder * mofowallet.com multiwallet founding member

marcus03

  • Sr. Member
  • ****
  • Karma: +24/-1
  • Offline Offline
  • Posts: 389
    • View Profile
Re: Encrypted Messages
« Reply #2 on: March 31, 2014, 08:01:18 pm »

NXT Solaris doesn't do message encryption yet, but if a standard is needed, this should be implemented:

https://nextcoin.org/index.php?topic=727.0
Logged
My Android NXT wallet project!
Raspberry Pi NXT node/Two VPS NRS nodes
NXT tips and donations: NXT-X5EB-VSL5-Z7DU-3GWTJ

wesley

  • Hero Member
  • *****
  • Karma: +204/-3
  • Offline Offline
  • Posts: 1159
    • View Profile
Re: Encrypted Messages
« Reply #3 on: March 31, 2014, 08:04:36 pm »

Are these encrypted messaging system compatible among various clients?

I do think so. Need to try that out soon.

We need to know what you add to identify encrypted messages. Do you add something at the start of the message?

Also, do you use a salt, etc.
Logged

Eadeqa

  • Hero Member
  • *****
  • Karma: +83/-68
  • Offline Offline
  • Posts: 1888
    • View Profile
Re: Encrypted Messages
« Reply #4 on: March 31, 2014, 08:21:23 pm »

Are these encrypted messaging system compatible among various clients?

I do think so. Need to try that out soon.

Please make it clear what exactly are you doing, so all Nxt users can communicate with each other, regardless of the client.

We need one standard. Otherwise it will become useless.

Logged
NXT-GZYP-FMRT-FQ9K-3YQGS

Graviton

  • Sr. Member
  • ****
  • Karma: +62/-30
  • Offline Offline
  • Posts: 297
    • View Profile
    • DGEX
Re: Encrypted Messages
« Reply #5 on: March 31, 2014, 08:34:19 pm »

I'm quite sure Dirk has followed the standard as far as such is available. Unfortunately I'm not versed on the technical encryption details he has been using, we were under pressure to release this tonight and he had to go right after that. I'm positive he will be answering these during Tuesday.
Logged
* dgex.com operator * nextcoin.org founder * mofowallet.com multiwallet founding member

fanaticalfishing

  • Full Member
  • ***
  • Karma: +10/-1
  • Offline Offline
  • Posts: 149
    • View Profile
Re: Encrypted Messages
« Reply #6 on: March 31, 2014, 11:09:09 pm »

Are these encrypted messaging system compatible among various clients?

I do think so. Need to try that out soon.

Please make it clear what exactly are you doing, so all Nxt users can communicate with each other, regardless of the client.

We need one standard. Otherwise it will become useless.

everything is in the git repository
Logged

verymuchso

  • Hero Member
  • *****
  • Karma: +118/-2
  • Offline Offline
  • Posts: 549
    • View Profile
    • HEAT Ledger
Re: Encrypted Messages
« Reply #7 on: April 01, 2014, 09:57:19 am »

Since there was no standard for encrypted messaging I had to think up my own. Encrypted messaging uses the XoredData class from the NXT repo https://bitbucket.org/JeanLucPicard/nxt/src/525a1924962f4107c679b61aea7a3b9a4b60a4ab/src/java/nxt/crypto/XoredData.java?at=master (thanks CfB!)

Creating messages is easy. Offspring uses two kinds of messages, Encrypted and Unencrypted.

Encrypted messages start with MAGIC_ENCRYPTED_MESSAGE_NUMBER (see below) which is an 8 byte identifier. Then the 32 byte nonce, and then the encrypted data.

Unencrypted messages start with MAGIC_UNENCRYPTED_MESSAGE_NUMBER, and then the message data which is passed through Convert.parseHexString (also from the NXT repo) https://bitbucket.org/JeanLucPicard/nxt/src/525a1924962f4107c679b61aea7a3b9a4b60a4ab/src/java/nxt/util/Convert.java?at=master.

Code: [Select]
  /* Encrypted messages start with this number */
  public static byte[] MAGIC_ENCRYPTED_MESSAGE_NUMBER = new byte[] { 0x43,
      0x52, 0x59, 0x50, 0x54, 0x45, 0x44, 0x21 };

  /* Non encrypted messages start with this number (Invisible Characters) */
  public static byte[] MAGIC_UNENCRYPTED_MESSAGE_NUMBER = new byte[] { 0x4d,
      0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x21 };

Everything is available on Github, client implementors can simply copy the code from there https://github.com/incentivetoken/offspring/blob/master/com.dgex.offspring.ui/src/com/dgex/offspring/ui/messaging/MessageCrypto.java

Note.. In the MessageCrypto class there also is a property called MAGIC_UNENCRYPTED_MESSAGE_NUMBER and MAGIC_ENCRYPTED_MESSAGE_NUMBER. Those are not the ones used in Offspring (guess i forgot to take those out) those properties are in https://github.com/incentivetoken/offspring/blob/master/com.dgex.offspring.config/src/com/dgex/offspring/config/Config.java
« Last Edit: April 01, 2014, 10:02:28 am by verymuchso »
Logged
HEAT: DEX | SDK | HOME

wesley

  • Hero Member
  • *****
  • Karma: +204/-3
  • Offline Offline
  • Posts: 1159
    • View Profile
Re: Encrypted Messages
« Reply #8 on: April 01, 2014, 10:06:15 am »

I thought it was decided to use this format: https://nextcoin.org/index.php?topic=727.0

(as cfb said)

Has he changed his mind?

XoredData is only available to clients that access the java api. Not sure if there is a javascript version of this...
Logged

wesley

  • Hero Member
  • *****
  • Karma: +204/-3
  • Offline Offline
  • Posts: 1159
    • View Profile
Re: Encrypted Messages
« Reply #9 on: April 01, 2014, 10:12:07 am »

btw, why do you add bytes to the unencrypted message? Do you ignore messages that don't have these bytes?
Logged

verymuchso

  • Hero Member
  • *****
  • Karma: +118/-2
  • Offline Offline
  • Posts: 549
    • View Profile
    • HEAT Ledger
Re: Encrypted Messages
« Reply #10 on: April 01, 2014, 10:17:44 am »

I thought it was decided to use this format: https://nextcoin.org/index.php?topic=727.0
(as cfb said)
Has he changed his mind?
XoredData is only available to clients that access the java api. Not sure if there is a javascript version of this...

Isnt that whats implemented in XoredData? XoredData is a small class, not much code at all.
If you have a js Curve25519 lib I dont see any problem why you cannot 1-on-1 copy XoredData from java to js.

btw, why do you add bytes to the unencrypted message? Do you ignore messages that don't have these bytes?

With all these nodecoin messages going around your list of messages gets cluttered fast. Let alone the number of different messages that will be implemented in the future.
If you want any way to filter that out you need this.

Messages are not ignored currently, I do use it to show a different icon for those messages
« Last Edit: April 01, 2014, 10:20:38 am by verymuchso »
Logged
HEAT: DEX | SDK | HOME

Isildur23

  • Full Member
  • ***
  • Karma: +29/-0
  • Offline Offline
  • Posts: 173
  • Banned!
    • View Profile
Re: Encrypted Messages
« Reply #11 on: April 01, 2014, 10:18:23 am »

Both encrypted and unencrypted(including group messaging) messages are stored on the blockchain, right? And they are purged during shrinking, right?
Logged

verymuchso

  • Hero Member
  • *****
  • Karma: +118/-2
  • Offline Offline
  • Posts: 549
    • View Profile
    • HEAT Ledger
Re: Encrypted Messages
« Reply #12 on: April 01, 2014, 10:21:42 am »

Both encrypted and unencrypted(including group messaging) messages are stored on the blockchain, right? And they are purged during shrinking, right?

Yes they are stored in the blockchain. Purging is not implemented (yet) currently messages are in the blockchain forever.
Logged
HEAT: DEX | SDK | HOME

verymuchso

  • Hero Member
  • *****
  • Karma: +118/-2
  • Offline Offline
  • Posts: 549
    • View Profile
    • HEAT Ledger
Re: Encrypted Messages
« Reply #13 on: April 01, 2014, 10:23:29 am »

Fun fact.. If you send an encrypted message to yourself. Only you can read it.
Logged
HEAT: DEX | SDK | HOME

wesley

  • Hero Member
  • *****
  • Karma: +204/-3
  • Offline Offline
  • Posts: 1159
    • View Profile
Re: Encrypted Messages
« Reply #14 on: April 01, 2014, 10:23:43 am »

Ok looks like XoredData also uses curve, so I can do that.

Btw cfb says:

Quote
[1/04/14 12:20:25] CFB: Use hash-based key agreement
[1/04/14 12:20:29] CFB: to get seed
[1/04/14 12:20:33] CFB: and then use XoredData
Logged

verymuchso

  • Hero Member
  • *****
  • Karma: +118/-2
  • Offline Offline
  • Posts: 549
    • View Profile
    • HEAT Ledger
Re: Encrypted Messages
« Reply #15 on: April 01, 2014, 10:31:58 am »

Ok looks like XoredData also uses curve, so I can do that.
Btw cfb says:
Quote
[1/04/14 12:20:25] CFB: Use hash-based key agreement
[1/04/14 12:20:29] CFB: to get seed
[1/04/14 12:20:33] CFB: and then use XoredData

I know. Thats here https://github.com/incentivetoken/offspring/blob/master/com.dgex.offspring.nxtCore/src/nxt/crypto/MyCurve25519.java
Logged
HEAT: DEX | SDK | HOME

fmiboy

  • Jr. Member
  • **
  • Karma: +20/-0
  • Offline Offline
  • Posts: 92
    • View Profile
Re: Encrypted Messages
« Reply #16 on: April 07, 2014, 06:57:17 am »

XoredData is very useful and changed my code to use Nxt core functions in last release.

But Clienxt doesn't add any prefix, it is pure https://nextcoin.org/index.php?topic=727.0

Didn't find any reason to add prefix to encrypted text. Since message stored as HEX format in blockchain after encryption. One can simple show HexToString, if user cannot read it they can decrypt the message. This might be extra step for user, but i think it is safer.

Beside if every client uses same/pure algorithm, we don't need any prefix. everything is encrypted and all clients can work with it.
« Last Edit: April 07, 2014, 06:58:57 am by fmiboy »
Logged

v39453

  • Full Member
  • ***
  • Karma: +12/-2
  • Offline Offline
  • Posts: 155
    • View Profile
Re: Encrypted Messages
« Reply #17 on: April 07, 2014, 09:05:04 am »

I'm not an expert, but I'm a little worried if xor is used to encrypt messages. To use xor you need a key - with true randomness - as long as the message. I don't think it matters what extra steps you add if you don't have that.

Like I said I'm not an expert, but I remember reading that xor is one of the things that does not work.
Logged

wesley

  • Hero Member
  • *****
  • Karma: +204/-3
  • Offline Offline
  • Posts: 1159
    • View Profile
Re: Encrypted Messages
« Reply #18 on: April 07, 2014, 09:12:04 am »

You should use the prefix CRYPTED!, that's how other clients are doing it.

XoredData is very useful and changed my code to use Nxt core functions in last release.

But Clienxt doesn't add any prefix, it is pure https://nextcoin.org/index.php?topic=727.0

Didn't find any reason to add prefix to encrypted text. Since message stored as HEX format in blockchain after encryption. One can simple show HexToString, if user cannot read it they can decrypt the message. This might be extra step for user, but i think it is safer.

Beside if every client uses same/pure algorithm, we don't need any prefix. everything is encrypted and all clients can work with it.
Logged

Come-from-Beyond

  • Hero Member
  • *****
  • Karma: +794/-671
  • Offline Offline
  • Posts: 4013
    • View Profile
Re: Encrypted Messages
« Reply #19 on: April 07, 2014, 09:15:51 am »

I'm not an expert, but I'm a little worried if xor is used to encrypt messages. To use xor you need a key - with true randomness - as long as the message. I don't think it matters what extra steps you add if you don't have that.

Like I said I'm not an expert, but I remember reading that xor is one of the things that does not work.

XoredData satisfies these conditions. Pay attention that it's a little bit different from https://nextcoin.org/index.php?topic=727.0
Logged
Pages: [1] 2 3 ... 14  All
 

elective-stereophonic
elective-stereophonic
assembly
assembly