Ejemplo n.º 1
0
        public void SetKeys(byte[] publicKey, byte[] secretKey)
        {
            byte[] s = new byte[ScalarMultiplication.OutputSize];
            ScalarMultiplication.Multiply(s, secretKey, publicKey);

            byte[] key = new byte[m_salsa20.OutputSize];

            m_salsa20.Transform(key, Constants.N, s, Constants.Sigma);
            m_secretBox.Key = key;
        }
Ejemplo n.º 2
0
        public KeyPair GenerateKeyPair()
        {
            byte[] publickKey = new byte[PublicKeySize];
            byte[] secretKey  = new byte[SecretKeySize];

            RNGCryptoServiceProvider random = new RNGCryptoServiceProvider();

            random.GetBytes(secretKey);

            ScalarMultiplication.MultiplyBase(publickKey, secretKey);

            return(new KeyPair(publickKey, secretKey));
        }