예제 #1
0
 public void Load(Func <string, byte[]> readbytes)
 {
     if (AuthKeys == null)
     {
         AuthKeys = new AuthKeyPair();
     }
     if (CryptKeys == null)
     {
         CryptKeys = new CryptKeyPair();
     }
     AuthKeys.Load(readbytes("BankAuthKeys.pubkey"));
     CryptKeys.Load(readbytes("BankCryptKeys.pubkey"));
 }
예제 #2
0
        public byte[] Encrypt(byte[] value)
        {
            var encrypted = new byte[value.Length];

            for (int i = 0; i < value.Length; i++)
            {
                if (CryptKeyPair.ContainsKey(value[i]))
                {
                    encrypted[i] = CryptKeyPair[value[i]];
                }
                else
                {
                    encrypted[i] = value[i];
                }
            }
            return(encrypted);
        }