Goedel.Cryptography.CryptoCatalog.Add C# (CSharp) Method

Add() public method

Add a cryptographic algorithm provider to the catalog
public Add ( CryptoProvider CryptoProvider ) : void
CryptoProvider CryptoProvider
return void
        public void Add(CryptoProvider CryptoProvider) {
            var ID = CryptoProvider.CryptoAlgorithmID;
            var Slot = (int)ID;
            var CryptoAlgorithm = CryptoProvider.CryptoAlgorithm;
            if (CryptoAlgorithm == null) {
                CryptoAlgorithm = new CryptoAlgorithm(CryptoProvider);
                }

            // If the array isn't big enough, then grow it
            if (Slot >= Algorithms.Length) {
                Array.Resize(ref Algorithms, Slot + 1);
                }

            Algorithms[(int)Slot] = CryptoAlgorithm;

            SetDefault(ref _AlgorithmDigest, CryptoAlgorithm, ID, CryptoAlgorithmClass.Digest);
            SetDefault(ref _AlgorithmMAC, CryptoAlgorithm, ID, CryptoAlgorithmClass.MAC);
            SetDefault(ref _AlgorithmEncryption, CryptoAlgorithm, ID, CryptoAlgorithmClass.Encryption);
            SetDefault(ref _AlgorithmSignature, CryptoAlgorithm, ID, CryptoAlgorithmClass.Signature);
            SetDefault(ref _AlgorithmExchange, CryptoAlgorithm, ID, CryptoAlgorithmClass.Exchange);
            }