DCNSConnectionDelegate Protocol Reference

Conforms to NSObject
Declared in DCNSConnection-Delegate.h

Overview

This protocol defines methods to be called on your own implementation of security within Distributed Classes. Typically, you will be asked to provide optional access controls in the form of authenticationData, and also to en-/decrypt data.

Access Controls

– authenticationDataForComponents:andSessionKey: required method

Allows for creating authentication data to append onto a given message.

- (nonnull NSData *)authenticationDataForComponents:(nonnull NSArray *)components andSessionKey:(nonnull char *)key

Parameters

components

The components of the message to be sent. (Note: components[0] is the main body of the message)

key

A 256-bit key generated by Diffie-Hellman used for the current session.

Return Value

Data to be appended to the message, or [NSData data].

Declared In

DCNSConnection-Delegate.h

– authenticateComponents:withData:andSessionKey: required method

Allows for verifying the authentication data appended by the remote to a message.

- (BOOL)authenticateComponents:(nonnull NSArray *)components withData:(nonnull NSData *)data andSessionKey:(nonnull char *)key

Parameters

components

The components of the message recieved. (Note: components[0] is the main body of the message)

data

The authentication data appended by the remote.

key

A 256-bit key generated by Diffie-Hellman used for the current session.

Return Value

The verification result

Declared In

DCNSConnection-Delegate.h

Encryption

– encryptData:andSessionKey: required method

Allows for providing encryption on a message.

- (nonnull NSData *)encryptData:(nonnull NSData *)plaintext andSessionKey:(nonnull char *)key

Parameters

plaintext

The input data to encrypt from the message.

key

A 256-bit key generated by Diffie-Hellman used for the current session.

Return Value

Encrypted data to send to the remote

Declared In

DCNSConnection-Delegate.h

– decryptData:andSessionKey: required method

Allows for decrypting a recieved message.

- (nonnull NSData *)decryptData:(nonnull NSData *)ciphertext andSessionKey:(nonnull char *)key

Parameters

ciphertext

The input encrypted data

key

A 256-bit key generated by Diffie-Hellman used for the current session.

Return Value

Decrypted data to process

Declared In

DCNSConnection-Delegate.h