Skip to main content
Version: 2.x

Class Crypto

Optional, pluggable encryption module for room communications. A Crypto object can be attached to an ODIN room on creation to enable customizable, end-to-end encryption (E2EE). When enabled, it intercepts data right before transmission and immediately after reception, allowing custom processing of datagrams, messages and custom peer user data.

Declaration
public class Crypto : IDisposable

Implements:
System.IDisposable

Properties

Handle

Cipher handle

Declaration
public OdinCipherHandle Handle { get; }

Methods

Create(OdinCipherHandle)

Create Crypto with OdinCipherHandle from Odin.Crypto.Methods

Declaration
public static Crypto Create(OdinCipherHandle handle)
Returns

OdinNative.Wrapper.Crypto: Crypto wrapper

Parameters
TypeNameDescription
OdinNative.Core.Imports.OdinCipherHandlehandlenative OdinCipherHandle

Create()

Create Crypto with a new OdinCipherHandle

Declaration
public static Crypto Create()
Returns

OdinNative.Wrapper.Crypto: new Crypto wrapper

Create(string)

Create Crypto with a new OdinCipherHandle and set password

Declaration
public static Crypto Create(string password)
Returns

OdinNative.Wrapper.Crypto: new Crypto wrapper

Parameters
TypeNameDescription
System.Stringpasswordcipher password

CryptoCreate()

Declaration
protected static OdinCipherHandle CryptoCreate()
Returns

OdinNative.Core.Imports.OdinCipherHandle

CryptoGetPeerStatus(int)

Get peer status of unencrypted/encrypted

Declaration
public virtual NativeBindings.OdinCryptoPeerStatus CryptoGetPeerStatus(int peerId)
Returns

OdinNative.Core.Imports.NativeBindings.OdinCryptoPeerStatus: encryption status of peer

Parameters
TypeNameDescription
System.Int32peerIdpeer to check

CryptoSetPassword(string)

Set Cipher password for native crypto

Declaration
public virtual bool CryptoSetPassword(string password)
Returns

System.Boolean: true on success, otherwise false

Parameters
TypeNameDescription
System.Stringpasswordcipher password

Dispose()

Cleanup OdinCipherHandle

Declaration
public void Dispose()

Implements

  • System.IDisposable