soporta el envio de correo para la creacion de cuentas y reseteo de las mismas

develop
Al Garcia 2 years ago
parent 86e7daab3b
commit 1b175ba19f
  1. BIN
      .vs/AOLBackend/DesignTimeBuild/.dtbcache.v2
  2. BIN
      .vs/AOLBackend/v17/.futdcache.v1
  3. BIN
      .vs/AOLBackend/v17/.suo
  4. BIN
      .vs/ProjectEvaluation/aolbackend.metadata.v2
  5. BIN
      .vs/ProjectEvaluation/aolbackend.projects.v2
  6. 1
      AOLBackend.csproj
  7. 2
      Contracts/IUsuarioRepository.cs
  8. 57
      Controllers/Usuarios/AuthController.cs
  9. 104
      Controllers/Usuarios/UsuariosController.cs
  10. 10
      DTO/Usuario/DTOUsuarioSendEmail.cs
  11. 15
      Repository/UsuariosRepository.cs
  12. 66
      Services/EmailSender/EmailSender.cs
  13. 178
      Services/Tools/CryptDecrypt.cs
  14. 8
      appsettings.json
  15. 20
      bin/Debug/net6.0/AOLBackend.deps.json
  16. BIN
      bin/Debug/net6.0/AOLBackend.dll
  17. BIN
      bin/Debug/net6.0/AOLBackend.pdb
  18. 8
      bin/Debug/net6.0/appsettings.json
  19. 4
      obj/AOLBackend.csproj.nuget.dgspec.json
  20. 1
      obj/Debug/net6.0/AOLBackend.MvcApplicationPartsAssemblyInfo.cs
  21. BIN
      obj/Debug/net6.0/AOLBackend.assets.cache
  22. BIN
      obj/Debug/net6.0/AOLBackend.csproj.AssemblyReference.cache
  23. 2
      obj/Debug/net6.0/AOLBackend.csproj.CoreCompileInputs.cache
  24. 2
      obj/Debug/net6.0/AOLBackend.csproj.FileListAbsolute.txt
  25. BIN
      obj/Debug/net6.0/AOLBackend.dll
  26. BIN
      obj/Debug/net6.0/AOLBackend.pdb
  27. BIN
      obj/Debug/net6.0/ref/AOLBackend.dll
  28. BIN
      obj/Debug/net6.0/refint/AOLBackend.dll
  29. 50
      obj/project.assets.json
  30. 16
      obj/project.nuget.cache
  31. 146
      obj/staticwebassets.pack.sentinel

Binary file not shown.

Binary file not shown.

@ -9,6 +9,7 @@
<ItemGroup>
<PackageReference Include="Dapper" Version="2.0.123" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.8" />
<PackageReference Include="Microsoft.Exchange.WebServices" Version="2.2.0" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="6.22.0" />
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="6.22.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />

@ -22,5 +22,7 @@ namespace AOLBackend.Contracts
public Task<IEnumerable<DTOClonarUsuario>> ClonarUsuario(DTOClonarUsuario user);
public Task<Boolean> Activate(int id, int Activo);
}
}

@ -1,11 +1,13 @@
using AOLBackend.Contracts;
using AOLBackend.DTO;
using AOLBackend.DTO.Usuario;
using AOLBackend.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.IdentityModel.Tokens;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using AOLBackend.Services.EmailSender;
using System.Text;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
@ -84,5 +86,60 @@ namespace AOLBackend.Controllers.Usuarios
{
return StatusCode(200, "Its Ok");
}
[Route("resetPassword")]
[HttpPost]
public async Task<IActionResult> ResetPassword(DTOLogin user)
{
try
{
var result = await _usuariosRepo.ResetPassword(user);
if (result == null)
{
return StatusCode(400, "Cuenta de usuario no existe");
}
var encrypted = AOLBackend.Services.Tools.CryptDecrypt.Encryption(user.Usuario);
EmailSender eSender = new EmailSender(_config);
string htmlContent = $@"<html>
<body>
<table style='font-size:14px; border: 1px solid #225EDD; padding: 5px; width: 1500px; height: 150px;'>
<tr style='background-color: #225EDD; color: #FFFFFF;'><td>Hola: {user.Usuario}, mediante el siguiente correo electronico, se le notifica que se ha cambiado su contraseña</td></tr>
<tr><td>Para validar que usted cambio su contraseña, favor de dar click al siguiente <a href='https://localhost:7000/api/Catalogos/Usuarios/AcceptReset?key={encrypted.Replace("/", "%2F").Replace("+", "%2B").Replace("=", "%3D")}'>link</a></td></tr>
<tr><td>Que tenga un excelente dia!</td></tr>
</table>
</body>
</html> ";
string resultSendEmail = eSender.SrvSendEmail(htmlContent, "Confirmacion de credenciales de alphaomega.com.mx", user.Usuario);
return Ok(resultSendEmail);
}
catch (Exception ex)
{
return StatusCode(500, ex);
}
}
[Route("AcceptReset")]
[HttpGet]
public async Task<IActionResult> AcceptReset(string key)
{
{
var decrypted = AOLBackend.Services.Tools.CryptDecrypt.Decryption(@key);
try
{
var usuarios = await _usuariosRepo.GetAllUsuariosShort();
foreach (DTOUsuarioShort usr in usuarios)
{
if (usr.Usuario == decrypted)
{
Boolean result = await _usuariosRepo.Activate(usr.id, 1);
if (result) return Ok("Cuenta activada!");
else return StatusCode(500, "Ocurrio un error!");
}
}
}
catch (Exception ex) { return StatusCode(500, ex.Message); }
return StatusCode(200, "Cuenta activada!");
}
}
}
}

@ -2,7 +2,9 @@
using AOLBackend.DTO;
using AOLBackend.DTO.Usuario;
using AOLBackend.Models;
using AOLBackend.Services.EmailSender;
using Microsoft.AspNetCore.Mvc;
using System.Text;
namespace AOLBackend.Controllers.Usuarios
{
@ -11,9 +13,13 @@ namespace AOLBackend.Controllers.Usuarios
public class UsuariosController : ControllerBase
{
private readonly IUsuarioRepository _usuariosRepo;
// private readonly IConfiguration _config;
private readonly IConfiguration _config;
public UsuariosController(IUsuarioRepository usuariosRepo, IConfiguration config) { _usuariosRepo = usuariosRepo; }
public UsuariosController(IUsuarioRepository usuariosRepo, IConfiguration config)
{
_usuariosRepo = usuariosRepo;
_config = config;
}
[Route("getUsuarioById")]
[HttpGet]
@ -52,7 +58,6 @@ namespace AOLBackend.Controllers.Usuarios
catch (Exception ex) { return StatusCode(500, ex.Message); }
}
[Route("Auth")]
[HttpPost]
public async Task<IActionResult> Auth(DTOLogin user)
@ -65,26 +70,6 @@ namespace AOLBackend.Controllers.Usuarios
catch (Exception ex) { return StatusCode(500, ex.Message); }
}
[Route("resetPassword")]
[HttpPost]
public async Task<IActionResult> ResetPassword(DTOLogin user)
{
try
{
var result = await _usuariosRepo.ResetPassword(user);
if (result == null)
{
return StatusCode(400, "Cuenta de usuario no existe");
}
return Ok(result);
}
catch (Exception ex)
{
return StatusCode(500, ex);
}
}
[Route("searchUsuario")]
[HttpPost]
public async Task<IActionResult> SearchUsuario(DTOLogin user)
@ -101,18 +86,33 @@ namespace AOLBackend.Controllers.Usuarios
}
}
[Route("Append")]
[HttpPost]
public async Task<IActionResult> POST(IUsuarios user)
public async Task<IActionResult> Append(IUsuarios user)
{
try
{
var usuario = await _usuariosRepo.CreateUsuario(user);
if (user.Id == 0)
{
/* Utilerias email = new Utilerias(_config);
Boolean sendOk = email.SendEmail("", usuario);*/
EmailSender eSender = new EmailSender(_config);
string htmlContent = $@"<html>
<body>
<table style='font-size:14px; border: 1px solid #225EDD; padding: 5px; width: 1500px; height: 150px;'>
<tr style='background-color: #225EDD; color: #FFFFFF;'><td>Hola: {user.Nombre}, mediante el siguiente correo electronico, se le notifica que se le ha creado un nuevo acceso</td></tr>
<tr><td>Para acceder a su cuenta, favor de entrar a: https://www.alphaomega.com.mx/</td></tr>
<tr><td>Nombre de usuario: <b>{user.Usuario}</b></td></tr>
<tr><td>Para poder entrar por primera vez, es necesario que establezca su contraseña</td></tr>
<tr><td>Para cambiar/establecer la contraseña, entre a <a href='https://www.alphaomega.com.mx/'>link</a> y de un click al link Olvido contraseña</td></tr>
<tr><td>Si por alguna razon, no recuerda su contrasena, repita este proceso de resetear su contraseña</td></tr>
<tr><td>No es necesario responder a este correo, ya que fue generado en automatico por el sistema.</td></tr>
<tr style='background-color: #F7192A; font-weight: bold; color: #FFFFFF'><td>Nota: Las credenciales de acceso son responsabilidad personal, nadie solo usted debe conocerlas</td></tr>
<tr><td>Que tenga un excelente dia!</td></tr>
</table>
</body>
</html> ";
string result = eSender.SrvSendEmail(htmlContent, "Confirmacion de credenciales de alphaomega.com.mx", user.Usuario);
return Ok(result);
}
return Ok(usuario);
}
@ -121,7 +121,7 @@ namespace AOLBackend.Controllers.Usuarios
[Route("clonarUsuario")]
[HttpPost]
public async Task<IActionResult> POST(DTOClonarUsuario user)
public async Task<IActionResult> clonarUsuario(DTOClonarUsuario user)
{
try
{
@ -130,5 +130,53 @@ namespace AOLBackend.Controllers.Usuarios
}
catch (Exception ex) { return StatusCode(500, ex.Message); }
}
[Route("SendEmail")]
[HttpGet]
public async Task<IActionResult> SendEmail(string Usuario, string Nombre, string Correo)
{
var content = Usuario;
EmailSender eSender = new EmailSender(_config);
string htmlContent = $@"<html>
<body>
<table style='font-size:14px; border: 1px solid #225EDD; padding: 5px; width: 1500px; height: 150px;'>
<tr style='background-color: #225EDD; color: #FFFFFF;'><td>Hola: {Nombre}, mediante el siguiente correo electronico, se le notifica que se le ha creado un nuevo acceso</td></tr>
<tr><td>Para acceder a su cuenta, favor de entrar a: https://www.alphaomega.com.mx/</td></tr>
<tr><td>Nombre de usuario: <b>{Usuario}</b></td></tr>
<tr><td>Para poder entrar por primera vez, es necesario que establezca su contraseña</td></tr>
<tr><td>Para cambiar/establecer la contraseña, puede ir al menu Reset, proporcione su nombre de usuario y su nueva contraseña</td></tr>
<tr><td>Si por alguna razon, no recuerda su contrasena, repita este proceso de resetear su contraseña</td></tr>
<tr><td>No es necesario responder a este correo, ya que fue generado en automatico por el sistema.</td></tr>
<tr style='background-color: #F7192A; font-weight: bold; color: #FFFFFF'><td>Nota: Las credenciales de acceso son responsabilidad personal, nadie solo usted debe conocerlas</td></tr>
<tr><td>Que tenga un excelente dia!</td></tr>
</table>
</body>
</html> ";
string result = eSender.SrvSendEmail(htmlContent, "Confirmacion de credenciales de alphaomega.com.mx", Correo);
return Ok(result);
}
/* [Route("AcceptReset")]
[HttpGet]
public async Task<IActionResult> AcceptReset(string key)
{
var decrypted = AOLBackend.Services.Tools.CryptDecrypt.Decryption(@key);
try
{
// return Ok(decrypted);
var usuarios = await _usuariosRepo.GetAllUsuariosShort();
foreach (DTOUsuarioShort usr in usuarios)
{
if (usr.Usuario == decrypted)
{
Boolean result = await _usuariosRepo.Activate(usr.id, 1);
if (result) return Ok("Cuenta activada!");
else return StatusCode(500, "Ocurrio un error!");
}
}
}
catch (Exception ex) { return StatusCode(500, ex.Message); }
return StatusCode(200, "Cuenta activada!");
} */
}
}

@ -0,0 +1,10 @@
namespace AOLBackend.DTO.Usuario
{
public class DTOUsuarioSendEmail
{
public string Usuario { get; set; } = null!;
public string Nombre { get; set; } = null!;
public string Correo { get; set; } = null!;
}
}

@ -131,5 +131,20 @@ namespace AOLBackend.Repository
return usuario.ToList();
}
}
public async Task<Boolean> Activate(int id, int Activo)
{
var query = "[Usuario.Activate]";
using (var connection = _context.CreateConnection())
{
var usuario = await connection.QueryAsync<IUsuarios>(query, new
{
@id = id,
@Activo = Activo,
}, commandType: CommandType.StoredProcedure);
return true;
}
}
}
}

@ -1,5 +1,9 @@
using System.Net;
using System.Net.Mail;
using System.Net;
using System;
using System.Collections.Generic;
using System.Text;
using EASendMail;
namespace AOLBackend.Services.EmailSender
{
@ -11,47 +15,47 @@ namespace AOLBackend.Services.EmailSender
{
_config = config;
}
public Boolean SendEmail(string htmlContent, Usuarios toUser)
public String SrvSendEmail(string htmlContent, string Subject, string toEmail)
{
string defaultPassword = _config.GetValue<string>("DefaultUser:Password");
string emailServer = _config.GetValue<string>("EmailServer");
int emailPort = _config.GetValue<int>("EmailPort");
htmlContent = (htmlContent.Length > 0) ? htmlContent : $@"<html>
<body>
<table style='font-size:14px; border: 1px solid #225EDD; padding: 5px; width: 1500px; height: 150px;'>
<tr style='background-color: #225EDD; color: #FFFFFF;'><td>Hola: {toUser.Nombre}, mediante el siguiente correo electronico, se le notifica que se le ha creado un nuevo acceso</td></tr>
<tr><td>Para acceder a su cuenta, favor de entrar a: http://reportes.gemcousa.com/</td></tr>
<tr><td>Nombre de usuario: <b>{toUser.Usuario}</b></td></tr>
<tr><td>Contraseña: <b>{defaultPassword}</b></td></tr>
<tr><td>Su contraseña inicial sera: {defaultPassword}, pero es necesario que la cambie antes de poder ingresar</td></tr>
<tr><td>Para cambiar la contraseña, puede ir al menu Reset, proporcione su nombre de usuario y su nueva contraseña</td></tr>
<tr><td>Si por alguna razon, no recuerda su contrasena, repita este proceso de resetear su contraseña</td></tr>
<tr><td>No es necesario responder a este correo, ya que fue generado en automatico por el sistema.</td></tr>
<tr style='background-color: #F7192A; font-weight: bold; color: #FFFFFF'><td>Nota: Las credenciales de acceso son responsabilidad personal, nadie solo usted debe conocerlas</td></tr>
<tr><td>Que tenga un excelente dia!</td></tr>
</table>
</body>
</html> ";
string EmailServer = _config.GetValue<string>("EmailServer");
string EmailAccount = _config.GetValue<string>("EmailAccount");
string[] Email = EmailAccount.Split('@');
int EmailPort = Convert.ToInt32(_config.GetValue<string>("EmailPort"));
string EmailPassword = _config.GetValue<string>("EmailPassword");
string EmailUser = Email[0];
string EmailDomain = Email[1].Replace("@", "");
DateTime now = DateTime.Now;
try
{
using (var smtp = new SmtpClient(emailServer, emailPort))
using (var smtp = new SmtpClient(EmailServer, EmailPort))
{
smtp.Credentials = new NetworkCredential(_config.GetValue<string>("Email"), _config.GetValue<string>("EmailPassword"));
var correo = new MailMessage();
correo.From = new MailAddress(_config.GetValue<string>("Email"), "noreply");
correo.To.Add(toUser.Correo);
correo.Subject = "Notification - Se le ha creado un nuevo acceso en http://reportes.gemcousa.com";
correo.Body = htmlContent;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new NetworkCredential(EmailAccount, EmailPassword);
smtp.Host = EmailServer;
var correo = new MailMessage(EmailAccount, toEmail);
correo.From = new MailAddress("<" + EmailAccount + ">", "<" + EmailUser + ">");
correo.Sender = new MailAddress("<" + EmailAccount + ">", "<" + EmailUser + ">");
correo.Headers.Add("Message-Id", String.Concat("<", now.ToString("yyMMdd"), ".", now.ToString("HHmmss"), "@alphaomega.com.mx>"));
correo.To.Add(toEmail);
correo.Subject = Subject;
correo.Body = "htmlContent";
correo.BodyEncoding = System.Text.Encoding.UTF8;
correo.SubjectEncoding = System.Text.Encoding.Default;
correo.IsBodyHtml = true;
smtp.Send(correo);
return true;
return "Message Sent Succesfully";
}
}
catch (Exception ex)
{
//if (ex.Source != null) throw;
return false;
return ex.ToString();
}
}
public String SrvSendEmail2(string htmlContent, string Subject, string toEmail)
{
return "";
}
}
}

@ -5,14 +5,15 @@ namespace AOLBackend.Services.Tools
{
public class CryptDecrypt
{
private readonly static string key = "G3mc0H42hk3y2!0$2*2#n4813dc2h47p";
private readonly static string keyString = "G3mc0H42hk3y2!0$2*2#n4813dc2h47p";
private readonly static int BlockSize = 128;
public static string Encrypt(string text)
{
byte[] iv = new byte[16];
byte[] array;
using (Aes aes = Aes.Create())
{
aes.Key = Encoding.UTF8.GetBytes(key);
aes.Key = Encoding.UTF8.GetBytes(keyString);
aes.IV = iv;
ICryptoTransform encrypt = aes.CreateEncryptor(aes.Key, aes.IV);
using (MemoryStream ms = new MemoryStream())
@ -36,7 +37,7 @@ namespace AOLBackend.Services.Tools
byte[] buffer = Convert.FromBase64String(text);
using (Aes aes = Aes.Create())
{
aes.Key = Encoding.UTF8.GetBytes(key);
aes.Key = Encoding.UTF8.GetBytes(keyString);
aes.IV = iv;
ICryptoTransform decryptor = aes.CreateDecryptor(aes.Key, aes.IV);
using (MemoryStream ms = new MemoryStream(buffer))
@ -51,5 +52,176 @@ namespace AOLBackend.Services.Tools
}
}
}
/* public static string EncryptString(string text)
{
var key = Encoding.UTF8.GetBytes(keyString);
using (var aesAlg = Aes.Create())
{
using (var encryptor = aesAlg.CreateEncryptor(key, aesAlg.IV))
{
using (var msEncrypt = new MemoryStream())
{
using (var csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))
using (var swEncrypt = new StreamWriter(csEncrypt)) { swEncrypt.Write(text); }
var iv = aesAlg.IV;
var decryptedContent = msEncrypt.ToArray();
var result = new byte[iv.Length + decryptedContent.Length];
Buffer.BlockCopy(iv, 0, result, 0, iv.Length);
Buffer.BlockCopy(decryptedContent, 0, result, iv.Length, decryptedContent.Length);
msEncrypt.Flush();
msEncrypt.Close();
return Convert.ToBase64String(result);
}
}
}
}
public static string DecryptString(string cipherText)
{
var fullCipher = Convert.FromBase64String(cipherText);
var iv = new byte[16];
var cipher = new byte[16];
Buffer.BlockCopy(fullCipher, 0, iv, 0, iv.Length);
Buffer.BlockCopy(fullCipher, iv.Length, cipher, 0, iv.Length);
var key = Encoding.UTF8.GetBytes(keyString);
using (var aesAlg = Aes.Create())
{
using (var decryptor = aesAlg.CreateDecryptor(key, iv))
{
string result;
using (var msDecrypt = new MemoryStream(cipher))
{
using (var csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read))
{
using (var srDecrypt = new StreamReader(csDecrypt))
{
result = srDecrypt.ReadToEnd();
}
}
}
return result;
}
}
}
private static char Cipher(char ch, int key)
{
if (!char.IsLetter(ch))
return ch;
char offset = char.IsUpper(ch) ? 'A' : 'a';
return (char)((((ch + key) - offset) % 26) + offset);
}
public static string Encipher(string input, int key)
{
string output = string.Empty;
foreach (char ch in input)
output += Cipher(ch, key);
return output;
}
public static string Decipher(string input, int key)
{
return Encipher(input, 26 - key);
}
static public byte[] Encryption(byte[] Data, bool DoOAEPPadding)
{
try
{
byte[] encryptedData;
using (RSACryptoServiceProvider RSA = new RSACryptoServiceProvider())
{
RSA.ImportParameters(RSA.ExportParameters(false));
encryptedData = RSA.Encrypt(Data, DoOAEPPadding);
}
return encryptedData;
}
catch (CryptographicException e)
{
Console.WriteLine(e.Message);
return null;
}
}
static public byte[] Decryption(byte[] Data, bool DoOAEPPadding)
{
try
{
byte[] decryptedData;
using (RSACryptoServiceProvider RSA = new RSACryptoServiceProvider())
{
RSA.ImportParameters(RSA.ExportParameters(true));
decryptedData = RSA.Decrypt(Data, DoOAEPPadding);
}
return decryptedData;
}
catch (CryptographicException e)
{
Console.WriteLine(e.ToString());
return null;
}
}
*/
public static string Encryption(string strText)
{
var publicKey = "<RSAKeyValue><Modulus>21wEnTU+mcD2w0Lfo1Gv4rtcSWsQJQTNa6gio05AOkV/Er9w3Y13Ddo5wGtjJ19402S71HUeN0vbKILLJdRSES5MHSdJPSVrOqdrll/vLXxDxWs/U0UT1c8u6k/Ogx9hTtZxYwoeYqdhDblof3E75d9n2F0Zvf6iTb4cI7j6fMs=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>";
var testData = Encoding.UTF8.GetBytes(strText);
using (var rsa = new RSACryptoServiceProvider(1024))
{
try
{
// client encrypting data with public key issued by server
rsa.FromXmlString(publicKey.ToString());
var encryptedData = rsa.Encrypt(testData, true);
var base64Encrypted = Convert.ToBase64String(encryptedData);
return base64Encrypted;
}
finally
{
rsa.PersistKeyInCsp = false;
}
}
}
public static string Decryption(string strText)
{
var privateKey = "<RSAKeyValue><Modulus>21wEnTU+mcD2w0Lfo1Gv4rtcSWsQJQTNa6gio05AOkV/Er9w3Y13Ddo5wGtjJ19402S71HUeN0vbKILLJdRSES5MHSdJPSVrOqdrll/vLXxDxWs/U0UT1c8u6k/Ogx9hTtZxYwoeYqdhDblof3E75d9n2F0Zvf6iTb4cI7j6fMs=</Modulus><Exponent>AQAB</Exponent><P>/aULPE6jd5IkwtWXmReyMUhmI/nfwfkQSyl7tsg2PKdpcxk4mpPZUdEQhHQLvE84w2DhTyYkPHCtq/mMKE3MHw==</P><Q>3WV46X9Arg2l9cxb67KVlNVXyCqc/w+LWt/tbhLJvV2xCF/0rWKPsBJ9MC6cquaqNPxWWEav8RAVbmmGrJt51Q==</Q><DP>8TuZFgBMpBoQcGUoS2goB4st6aVq1FcG0hVgHhUI0GMAfYFNPmbDV3cY2IBt8Oj/uYJYhyhlaj5YTqmGTYbATQ==</DP><DQ>FIoVbZQgrAUYIHWVEYi/187zFd7eMct/Yi7kGBImJStMATrluDAspGkStCWe4zwDDmdam1XzfKnBUzz3AYxrAQ==</DQ><InverseQ>QPU3Tmt8nznSgYZ+5jUo9E0SfjiTu435ihANiHqqjasaUNvOHKumqzuBZ8NRtkUhS6dsOEb8A2ODvy7KswUxyA==</InverseQ><D>cgoRoAUpSVfHMdYXW9nA3dfX75dIamZnwPtFHq80ttagbIe4ToYYCcyUz5NElhiNQSESgS5uCgNWqWXt5PnPu4XmCXx6utco1UVH8HGLahzbAnSy6Cj3iUIQ7Gj+9gQ7PkC434HTtHazmxVgIR5l56ZjoQ8yGNCPZnsdYEmhJWk=</D></RSAKeyValue>";
var testData = Encoding.UTF8.GetBytes(strText);
using (var rsa = new RSACryptoServiceProvider(1024))
{
try
{
var base64Encrypted = strText;
// server decrypting data with private key
rsa.FromXmlString(privateKey);
var resultBytes = Convert.FromBase64String(base64Encrypted);
var decryptedBytes = rsa.Decrypt(resultBytes, true);
var decryptedData = Encoding.UTF8.GetString(decryptedBytes);
return decryptedData.ToString();
}
finally
{
rsa.PersistKeyInCsp = false;
}
}
}
}
}

@ -20,9 +20,11 @@
"ExpirationHours": 4,
"ExpirationMinutes": 1
},
"EmailServer": "146.20.161.11",
"EmailPort": 587,
"Email": "noreply@alphaomega.com.mx",
"EmailServer": "alphaomega-com-mx.mail.protection.outlook.com",
"EmailPort": "25",
"EmailUser": "noreply",
"EmailDomian":"alphaomega.com.mx",
"EmailAccount":"noreply@alphaomega.com.mx",
"EmailPassword": "Al%G22a3",
"pathArchivoElectronico": "D:\\data\\ArchivoElectronicoSIR\\www.gemcousa.com\\SIR-GEMCO\\DOCS-SIR\\",
"pathTemp": "D:\\data\\temp\\",

@ -10,6 +10,7 @@
"dependencies": {
"Dapper": "2.0.123",
"Microsoft.AspNetCore.Authentication.JwtBearer": "6.0.8",
"Microsoft.Exchange.WebServices": "2.2.0",
"Microsoft.IdentityModel.JsonWebTokens": "6.22.0",
"Microsoft.IdentityModel.Tokens": "6.22.0",
"Swashbuckle.AspNetCore": "6.2.3",
@ -40,6 +41,18 @@
}
},
"Microsoft.CSharp/4.5.0": {},
"Microsoft.Exchange.WebServices/2.2.0": {
"runtime": {
"lib/40/Microsoft.Exchange.WebServices.Auth.dll": {
"assemblyVersion": "15.0.0.0",
"fileVersion": "15.0.913.0"
},
"lib/40/Microsoft.Exchange.WebServices.dll": {
"assemblyVersion": "15.0.0.0",
"fileVersion": "15.0.913.15"
}
}
},
"Microsoft.Extensions.ApiDescription.Server/3.0.0": {},
"Microsoft.IdentityModel.Abstractions/6.22.0": {
"runtime": {
@ -271,6 +284,13 @@
"path": "microsoft.csharp/4.5.0",
"hashPath": "microsoft.csharp.4.5.0.nupkg.sha512"
},
"Microsoft.Exchange.WebServices/2.2.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-NlkaTD0uWtg9VbiWq0VDWMBPzHFknH3tmstrxt0acrT09LBGqATTjRpsGOODz6tUdX7/dehBinxsf75U5Uw/+A==",
"path": "microsoft.exchange.webservices/2.2.0",
"hashPath": "microsoft.exchange.webservices.2.2.0.nupkg.sha512"
},
"Microsoft.Extensions.ApiDescription.Server/3.0.0": {
"type": "package",
"serviceable": true,

Binary file not shown.

Binary file not shown.

@ -20,8 +20,12 @@
"ExpirationHours": 4,
"ExpirationMinutes": 1
},
"EmailServer": "146.20.161.11",
"EmailPort": 587,
"EmailServer": "alphaomega-com-mx.mail.protection.outlook.com",
"EmailPort": "25",
"EmailUser": "noreply",
"EmailDomian":"alphaomega.com.mx",
"EmailAccount":"noreply@alphaomega.com.mx",
"EmailPassword": "Al%G22a3",
"pathArchivoElectronico": "D:\\data\\ArchivoElectronicoSIR\\www.gemcousa.com\\SIR-GEMCO\\DOCS-SIR\\",
"pathTemp": "D:\\data\\temp\\",
"pathFotosBodega": "D:\\data\\Bodega\\Fotos\\",

@ -48,6 +48,10 @@
"target": "Package",
"version": "[6.0.8, )"
},
"Microsoft.Exchange.WebServices": {
"target": "Package",
"version": "[2.2.0, )"
},
"Microsoft.IdentityModel.JsonWebTokens": {
"target": "Package",
"version": "[6.22.0, )"

@ -1,7 +1,6 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.

@ -1 +1 @@
543d6e2052e74dfe9cc3f60cc2cb0d6f72d7753c
5f1a72562e39ad6a97279c67e056dd811ddf7a4f

@ -82,3 +82,5 @@ C:\projects\staging\AOLBackend\obj\Debug\net6.0\refint\AOLBackend.dll
C:\projects\staging\AOLBackend\obj\Debug\net6.0\AOLBackend.pdb
C:\projects\staging\AOLBackend\obj\Debug\net6.0\AOLBackend.genruntimeconfig.cache
C:\projects\staging\AOLBackend\obj\Debug\net6.0\ref\AOLBackend.dll
C:\projects\staging\AOLBackend\bin\Debug\net6.0\Microsoft.Exchange.WebServices.Auth.dll
C:\projects\staging\AOLBackend\bin\Debug\net6.0\Microsoft.Exchange.WebServices.dll

Binary file not shown.

Binary file not shown.

@ -35,6 +35,17 @@
"lib/netcoreapp2.0/_._": {}
}
},
"Microsoft.Exchange.WebServices/2.2.0": {
"type": "package",
"compile": {
"lib/40/Microsoft.Exchange.WebServices.Auth.dll": {},
"lib/40/Microsoft.Exchange.WebServices.dll": {}
},
"runtime": {
"lib/40/Microsoft.Exchange.WebServices.Auth.dll": {},
"lib/40/Microsoft.Exchange.WebServices.dll": {}
}
},
"Microsoft.Extensions.ApiDescription.Server/3.0.0": {
"type": "package",
"build": {
@ -440,6 +451,26 @@
"version.txt"
]
},
"Microsoft.Exchange.WebServices/2.2.0": {
"sha512": "NlkaTD0uWtg9VbiWq0VDWMBPzHFknH3tmstrxt0acrT09LBGqATTjRpsGOODz6tUdX7/dehBinxsf75U5Uw/+A==",
"type": "package",
"path": "microsoft.exchange.webservices/2.2.0",
"files": [
".nupkg.metadata",
".signature.p7s",
"doc/License Terms.rtf",
"doc/README.htm",
"doc/Redist.txt",
"lib/40/Microsoft.Exchange.WebServices.Auth.dll",
"lib/40/Microsoft.Exchange.WebServices.Auth.pdb",
"lib/40/Microsoft.Exchange.WebServices.Auth.xml",
"lib/40/Microsoft.Exchange.WebServices.dll",
"lib/40/Microsoft.Exchange.WebServices.pdb",
"lib/40/Microsoft.Exchange.WebServices.xml",
"microsoft.exchange.webservices.2.2.0.nupkg.sha512",
"microsoft.exchange.webservices.nuspec"
]
},
"Microsoft.Extensions.ApiDescription.Server/3.0.0": {
"sha512": "LH4OE/76F6sOCslif7+Xh3fS/wUUrE5ryeXAMcoCnuwOQGT5Smw0p57IgDh/pHgHaGz/e+AmEQb7pRgb++wt0w==",
"type": "package",
@ -1089,6 +1120,7 @@
"net6.0": [
"Dapper >= 2.0.123",
"Microsoft.AspNetCore.Authentication.JwtBearer >= 6.0.8",
"Microsoft.Exchange.WebServices >= 2.2.0",
"Microsoft.IdentityModel.JsonWebTokens >= 6.22.0",
"Microsoft.IdentityModel.Tokens >= 6.22.0",
"Swashbuckle.AspNetCore >= 6.2.3",
@ -1143,6 +1175,10 @@
"target": "Package",
"version": "[6.0.8, )"
},
"Microsoft.Exchange.WebServices": {
"target": "Package",
"version": "[2.2.0, )"
},
"Microsoft.IdentityModel.JsonWebTokens": {
"target": "Package",
"version": "[6.22.0, )"
@ -1185,5 +1221,17 @@
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\6.0.300\\RuntimeIdentifierGraph.json"
}
}
}
},
"logs": [
{
"code": "NU1701",
"level": "Warning",
"warningLevel": 1,
"message": "Package 'Microsoft.Exchange.WebServices 2.2.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework 'net6.0'. This package may not be fully compatible with your project.",
"libraryId": "Microsoft.Exchange.WebServices",
"targetGraphs": [
"net6.0"
]
}
]
}

@ -1,12 +1,13 @@
{
"version": 2,
"dgSpecHash": "h1u0HQs4mEbTV4WJsMrgE3Hunt3CLJp7/89fjgdV6zy7e/QRVuYOEoC0xk2j+AEakhvCr9H5jhqvtHtrM+sycw==",
"dgSpecHash": "vtGVP4zlfFh7svdNka07v8HE+UbShU24VyzMRrIOsfcHbJgxmkIUVuYTGIVIeBwbHwL1S8FAVOvE2Y5Jpbw8Lg==",
"success": true,
"projectFilePath": "C:\\projects\\staging\\AOLBackend\\AOLBackend.csproj",
"expectedPackageFiles": [
"C:\\Users\\Alfonso Garcia\\.nuget\\packages\\dapper\\2.0.123\\dapper.2.0.123.nupkg.sha512",
"C:\\Users\\Alfonso Garcia\\.nuget\\packages\\microsoft.aspnetcore.authentication.jwtbearer\\6.0.8\\microsoft.aspnetcore.authentication.jwtbearer.6.0.8.nupkg.sha512",
"C:\\Users\\Alfonso Garcia\\.nuget\\packages\\microsoft.csharp\\4.5.0\\microsoft.csharp.4.5.0.nupkg.sha512",
"C:\\Users\\Alfonso Garcia\\.nuget\\packages\\microsoft.exchange.webservices\\2.2.0\\microsoft.exchange.webservices.2.2.0.nupkg.sha512",
"C:\\Users\\Alfonso Garcia\\.nuget\\packages\\microsoft.extensions.apidescription.server\\3.0.0\\microsoft.extensions.apidescription.server.3.0.0.nupkg.sha512",
"C:\\Users\\Alfonso Garcia\\.nuget\\packages\\microsoft.identitymodel.abstractions\\6.22.0\\microsoft.identitymodel.abstractions.6.22.0.nupkg.sha512",
"C:\\Users\\Alfonso Garcia\\.nuget\\packages\\microsoft.identitymodel.jsonwebtokens\\6.22.0\\microsoft.identitymodel.jsonwebtokens.6.22.0.nupkg.sha512",
@ -31,5 +32,16 @@
"C:\\Users\\Alfonso Garcia\\.nuget\\packages\\system.security.cryptography.cng\\4.5.0\\system.security.cryptography.cng.4.5.0.nupkg.sha512",
"C:\\Users\\Alfonso Garcia\\.nuget\\packages\\system.security.principal.windows\\4.7.0\\system.security.principal.windows.4.7.0.nupkg.sha512"
],
"logs": []
"logs": [
{
"code": "NU1701",
"level": "Warning",
"warningLevel": 1,
"message": "Package 'Microsoft.Exchange.WebServices 2.2.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework 'net6.0'. This package may not be fully compatible with your project.",
"libraryId": "Microsoft.Exchange.WebServices",
"targetGraphs": [
"net6.0"
]
}
]
}

@ -303,3 +303,149 @@
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0

Loading…
Cancel
Save