示例#1
0
 internal JObjectCrypto(IBoxedMessageCrypto boxedMessageCrypto)
 {
     _boxedMessageCrypto = boxedMessageCrypto;
 }
        public static BoxedMessage Encrypt(this IBoxedMessageCrypto boxedMessageCrypto, string nessage, string publicKey)
        {
            var publicKeyBytes = HexConverter.HexToBinary(publicKey);

            return(boxedMessageCrypto.Encrypt(nessage, publicKeyBytes));
        }
        public static string Decrypt(this IBoxedMessageCrypto boxedMessageCrypto, string boxedMessageAsString, string privateKey)
        {
            var privateKeyBytes = HexConverter.HexToBinary(privateKey);

            return(boxedMessageCrypto.Decrypt(boxedMessageAsString, privateKeyBytes));
        }
        public static string Decrypt(this IBoxedMessageCrypto boxedMessageCrypto, string boxedMessageAsString, byte[] privateKey)
        {
            var boxedMessage = BoxedMessage.Create(boxedMessageAsString);

            return(boxedMessageCrypto.Decrypt(boxedMessage, privateKey));
        }