public void CipherTest() { KeyPair victor = BFCipher.Extract(master, "victor", new Random()); String msg = "hola"; byte[] msgByte; byte[] plainByte; String plain; BFCText encrypted; msgByte = Encoding.UTF8.GetBytes(msg); encrypted = BFCipher.encrypt((BFUserPublicKey)victor.Public, msgByte, new Random()); plainByte = BFCipher.decrypt(encrypted, (BFUserPrivateKey)victor.Private); plain = Encoding.UTF8.GetString(plainByte); Assert.AreEqual(msg, plain); }
public SerializedPrivateKey Private(string id) { KeyPair user = BFCipher.Extract(master, id, new Random()); return(((BFUserPrivateKey)user.Private).Serialize()); }