Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
SecurityBinary.cs
2
4{
8 public abstract class SecurityBinary : SecurityObject
9 {
10 protected byte[]? value;
11
15 public override bool IsConfigured => this.value is not null;
16
22 public override bool Configure(Vector SecurityInfo)
23 {
24 if (SecurityInfo.LastElement is byte[] Value)
25 this.value = Value;
26 else if (SecurityInfo.LastElement is Vector V &&
27 V.Length == 1 &&
28 V.FirstElement is byte[] Value2)
29 {
30 this.value = Value2;
31 }
32 else if (SecurityInfo.FirstElement is SecurityBinary Binary)
33 this.value = Binary.Value;
34 else
35 return false;
36
37 return true;
38 }
39
43 public byte[] Value => this.value!;
44
46 public override string ToString()
47 {
48 return this.GetType().Name + ": " + Hashes.BinaryToString(this.value ?? [], true);
49 }
50 }
51}
Abstract base class for security objects that represent named binary values.
override bool IsConfigured
If the object has been configured.
override bool Configure(Vector SecurityInfo)
If the object can be configured by the security information provided.
Abstract base class for security objects.
Contains methods for simple hash calculations.
Definition: Hashes.cs:57
static string BinaryToString(byte[] Data)
Converts an array of bytes to a string with their hexadecimal representations (in lower case).
Definition: Hashes.cs:63