示例#1
0
        public void WhenTheContextStringForAProtocolContextIsGenerated()
        {
            const CipherSuiteName  cipherSuiteName = CipherSuiteName.Ristretto255_SHA512;
            PrimeOrderGroupFactory pogFactory      = new();
            HashFunctionFactory    hfFactory       = new();

            _cipherSuite = new CipherSuite(cipherSuiteName, pogFactory, hfFactory);

            _actualContextString   = _cipherSuite.ProtocolContextString.ToArray();
            _expectedContextString = new byte[] { 0, 0, (byte)cipherSuiteName }; // Mode 0, Cipher 0x0004
        }
示例#2
0
        public void WhenInitialisationIsPerformed()
        {
            const CipherSuiteName  cipherSuiteName = CipherSuiteName.Ristretto255_SHA512;
            PrimeOrderGroupFactory pogFactory      = new();
            HashFunctionFactory    hfFactory       = new();
            CipherSuite            cipherSuite     = new CipherSuite(cipherSuiteName, ProtocolMode.Base, pogFactory, hfFactory);

            SodiumLibrary.InitialiseCryptography();
            LogAssert.AreEqual("Sodium library version", "1.0.18", SodiumLibrary.GetSodiumLibraryVersion());

            BaseModeClientContext clientContext = new(cipherSuite);
            BaseModeServerContext serverContext = new(cipherSuite);
        }
        public void BeforeScenario()
        {
            SodiumLibrary.InitialiseCryptography();

            _cipherSuiteName = CipherSuiteName.Ristretto255_SHA512;
            PrimeOrderGroupFactory pogFactory = new();
            HashFunctionFactory    hfFactory  = new();

            _cipherSuite = new CipherSuite(_cipherSuiteName, ProtocolMode.Base, pogFactory, hfFactory);

            _pog = _cipherSuite.PrimeOrderGroup;

            _clientContext = new(_cipherSuite);
            _serverContext = new(_cipherSuite);
        }
示例#4
0
 public IPrimeOrderGroup Create(CipherSuiteName cipherSuiteName, ICipherSuite cipherSuite)
 => cipherSuiteName switch
 {
 public IHashFunction Create(CipherSuiteName cipherSuiteName, ICipherSuite cipherSuite)
 => cipherSuiteName switch
 {