Completed

Script .Net com criptografia Rsa

Published on the December 05, 2023 in IT & Programming

About this project

Open

Criar um script simples de .net para criptografar dados em rsa pkcs1. O script deve rodar em Azure Functions.

Exemplo do script a ser alterado para rodar em Azure Functions.
Using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            var resp = Test("TESTETESTE|08/01/2021", "<RSAKeyValue><Modulus>*******</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>");

        }
        static string Test(string Valor, string Chave)
        {
            using (RSACryptoServiceProvider RSA = new RSACryptoServiceProvider())
            {
                RSA.FromXmlString(Chave);
                // Utilizar o modo  PKCS1
                var encryptedData = RSA.Encrypt(System.Text.Encoding.UTF8.GetBytes(Valor), false);
                return Convert.ToBase64String(encryptedData);
            }
        }

    }
}

Category IT & Programming
Subcategory Web development
What is the scope of the project? Small change or bug
Is this a project or a position? Project
I currently have I have specifications
Required availability As needed
Roles needed Developer

Delivery term: Not specified

Skills needed