• Home
  • Tutorials
  • API Documentation
  • Asset Store
Show / Hide Table of Contents
  • SuperNet.Netcode.Compress
    • CompressorDeflate
    • CompressorLZF
    • ICompressor
  • SuperNet.Netcode.Crypto
    • CryptoAES
    • CryptoECDH
    • CryptoRandom
    • CryptoRSA
    • Curve25519
    • ICryptoAuthenticator
    • ICryptoEncryptor
    • ICryptoExchanger
    • ICryptoRandom
  • SuperNet.Netcode.Transport
    • ConnectionRequest
    • DisconnectReason
    • Host
    • HostConfig
    • HostEvents
    • HostStatistics
    • HostTimespan
    • HostTimestamp
    • IHostListener
    • IMessage
    • IMessageListener
    • IPeerListener
    • MessageEvents
    • MessageReceived
    • MessageSent
    • Peer
    • PeerConfig
    • PeerEvents
    • PeerStatistics
  • SuperNet.Netcode.Util
    • Allocator
    • ArrayPool<T>
    • CRC32
    • IPComparer
    • IPResolver
    • IWritable
    • ObjectPool<T>
    • Reader
    • Serializer
    • Writer
  • SuperNet.Unity.Components
    • INetworkAuthoritative
    • INetworkRegisterable
    • INetworkRollbackable
    • NetworkAnimation
    • NetworkAnimator
    • NetworkAuthority
    • NetworkPrefab
    • NetworkRegistrar
    • NetworkSpawner
    • NetworkSyncModeMethod
    • NetworkSyncModeVector2
    • NetworkSyncModeVector3
    • NetworkTransform
  • SuperNet.Unity.Core
    • NetworkComponent
    • NetworkHost
    • NetworkIdentity
    • NetworkIdentityExtensions
    • NetworkManager
  • SuperNet.Unity.Editor
    • NetworkAuthorityEditor
    • NetworkHostEditor
    • NetworkHostEditor.BandwithUnit
    • NetworkIdentityDrawer
    • NetworkManagerEditor
    • NetworkPrefabEditor
    • NetworkSpawnerEditor

Class CryptoRSA

Authenticator based on 2048-bit RSA (Rivest–Shamir–Adleman).

Inheritance
System.Object
CryptoRSA
Implements
ICryptoAuthenticator
IDisposable
Namespace: SuperNet.Netcode.Crypto
Assembly: cs.temp.dll.dll
Syntax
public sealed class CryptoRSA : ICryptoAuthenticator, IDisposable

Constructors

CryptoRSA(Allocator)

Create a new RSA authenticator.

Declaration
public CryptoRSA(Allocator allocator = null)
Parameters
Type Name Description
Allocator allocator

Allocator to use for keys or null for none.

Properties

SignatureLength

Number of bytes in the signature. For RSA this is 256.

Declaration
public int SignatureLength { get; }
Property Value
Type Description
System.Int32

Methods

Dispose()

Instantly dispose of all resources.

Declaration
public void Dispose()

ExportPrivateKey()

Export all RSA parameters as a Base64 string.

Declaration
public string ExportPrivateKey()
Returns
Type Description
System.String

Base64 encoded parameters.

ExportPublicKey()

Export RSA modulus as a Base64 string.

Declaration
public string ExportPublicKey()
Returns
Type Description
System.String

Base64 encoded RSA modulus.

ImportPrivateKey(String)

Import previously exported private key.

Declaration
public void ImportPrivateKey(string privateKey)
Parameters
Type Name Description
System.String privateKey

Private key to import.

Sign(ArraySegment<Byte>, ArraySegment<Byte>)

Generate a signature of that can then be verified by the public key.

Declaration
public void Sign(ArraySegment<byte> data, ArraySegment<byte> output)
Parameters
Type Name Description
ArraySegment<System.Byte> data

Data to sign.

ArraySegment<System.Byte> output

Output to write signature to.

Verify(ArraySegment<Byte>, ArraySegment<Byte>, String)

Verify that signature has been signed by someone with the private key.

Declaration
public bool Verify(ArraySegment<byte> data, ArraySegment<byte> signature, string remotePublicKey)
Parameters
Type Name Description
ArraySegment<System.Byte> data

Data that has been signed.

ArraySegment<System.Byte> signature

Signature that has been generated.

System.String remotePublicKey

Public key corresponding to the private key that signed the data.

Returns
Type Description
System.Boolean

True if verified, false if not.

Implements

ICryptoAuthenticator
IDisposable
Back to top Generated by DocFX