Example #1
0
        /// <summary>
        /// Find KeyDerivationFunctionEntry with key identifier
        /// </summary>
        /// <param name="keyIdentifier">Key identifier to seek</param>
        /// <returns>KeyDerivationFunctionEntry if match is found; null otherwise</returns>
        public KeyDerivationFunctionEntry FindKeyDerivationFunctionEntryWithKeyIdentifier(string keyIdentifier)
        {
            KeyDerivationFunctionEntry returnValue = null;

            foreach (KeyDerivationFunctionEntry kdfe in keyDerivationFunctionEntries)
            {
                if (keyIdentifier == kdfe.GetKeyIdentifier())
                {
                    returnValue = kdfe;
                    break;
                }
            }

            return(returnValue);
        }
Example #2
0
        private (bool success, string possibleError) MandatoryCommonChecks(object checkForNull, string objectToCheckForError, string keyIdentifier)
        {
            if (checkForNull == null)
            {
                return(success : false, possibleError : $"{objectToCheckForError} cannot be null");
            }

            KeyDerivationFunctionEntry kdfe = this.FindKeyDerivationFunctionEntryWithKeyIdentifier(keyIdentifier);

            if (kdfe == null)
            {
                return(success : false, possibleError : $"Cannot find key identifier matching to: {keyIdentifier}");
            }

            return(success : true, possibleError : "");
        }
Example #3
0
 /// <summary>
 /// Constructor for creating CommonSecretsContainer with one Key Derivation Function
 /// </summary>
 /// <param name="primaryKDF">"Primary" key derivation function</param>
 public CommonSecretsContainer(KeyDerivationFunctionEntry primaryKDF)
 {
     this.version = currentVersionNumber;
     this.keyDerivationFunctionEntries.Add(primaryKDF);
 }