Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
LdsSecurityObject.cs
4
6{
11 {
12 private bool configured;
13
18 {
19 }
20
24 public override string Oid => "2.23.136.1.1.1";
25
29 public override bool IsConfigured => this.configured;
30
36 public override bool Configure(Vector SecurityInfo)
37 {
38 if (SecurityInfo.Length < 3)
39 return false;
40
41 if (SecurityInfo.FirstElement is not System.Numerics.BigInteger Version)
42 return false;
43
44 ChunkedList<HashFunction> HashFunctions2 = [];
45
46 if (SecurityInfo[1] is HashFunction HashFunction)
47 HashFunctions2.Add(HashFunction);
48 else if (SecurityInfo[1] is Vector HashFunctions)
49 {
50 foreach (object Item in HashFunctions)
51 {
52 if (Item is null || Item is not HashFunction HashFunction2)
53 return false;
54
55 HashFunctions2.Add(HashFunction2);
56 }
57 }
58 else
59 return false;
60
61 if (SecurityInfo[2] is not Vector DataGroupHashValues)
62 return false;
63
64 this.Version = (int)Version;
65
66 Dictionary<int, byte[]> DataGroupHashValues2 = [];
67
68 foreach (object Item in DataGroupHashValues)
69 {
70 if (Item is null ||
71 Item is not Vector ItemArray ||
72 ItemArray.Length < 2 ||
73 ItemArray.FirstElement is not System.Numerics.BigInteger DataGroup ||
74 DataGroup < int.MinValue || DataGroup > int.MaxValue ||
75 ItemArray[1] is not byte[] Digest)
76 {
77 return false;
78 }
79
80 DataGroupHashValues2[(int)DataGroup] = Digest;
81 }
82
83 this.HashFunctions = [.. HashFunctions2];
84 this.DataGroupHashValues = DataGroupHashValues2;
85 this.configured = true;
86
87 return true;
88 }
89
93 public int Version { get; private set; }
94
98 public HashFunction[]? HashFunctions { get; private set; }
99
103 public Dictionary<int, byte[]>? DataGroupHashValues { get; private set; }
104 }
105}
LDS Security Object V1. Reference: §4.6.2.3, ICAO Doc 9303-10.
override bool IsConfigured
If the object has been configured.
override string Oid
OID identifying the type of object.
Dictionary< int, byte[]>? DataGroupHashValues
Data Group Hash Values.
override bool Configure(Vector SecurityInfo)
If the object can be configured by the security information provided.
LdsSecurityObject()
LDS Security Object V1. Reference: §4.6.2.3, ICAO Doc 9303-10.
Abstract base class for security objects.
A chunked list is a linked list of chunks of objects of type T .
Definition: ChunkedList.cs:54
void Add(T Item)
Adds an item to the collection.
Definition: ChunkedList.cs:272