2020-05-30 08:06:08 +00:00
|
|
|
using Sodium;
|
|
|
|
|
|
|
|
using chestcrypto.session;
|
|
|
|
using chestcrypto;
|
|
|
|
|
|
|
|
namespace chestcrypto.session.crypto{
|
|
|
|
|
2020-05-30 23:00:49 +00:00
|
|
|
internal class SessionCrypto{
|
2020-05-30 08:06:08 +00:00
|
|
|
|
2020-05-30 23:00:49 +00:00
|
|
|
public static byte[] encrypt(Session activeSession, byte[] message){
|
2020-05-30 08:06:08 +00:00
|
|
|
byte[] publicKey = activeSession.getLatestPublicKey();
|
2020-05-30 23:44:02 +00:00
|
|
|
byte[] privateKey = activeSession.getOurMasterPrivate();
|
2020-05-30 08:06:08 +00:00
|
|
|
return Curve25519.encrypt(privateKey, publicKey, message);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|