static void Main(string[] args) { Console.WriteLine("Hello World!"); var serviceProvider = new ServiceCollection() .AddCertificateManager() .BuildServiceProvider(); var cc = serviceProvider.GetService <CreateCertificates>(); var cert2048 = CreateRsaCertificates.CreateRsaCertificate(cc, 2048); var text = "I have a big dog. You've got a cat. We all love animals!"; Console.WriteLine("-- Encrypt Decrypt asymmetric --"); Console.WriteLine(""); var asymmetricEncryptDecrypt = new AsymmetricEncryptDecrypt(); var encryptedText = asymmetricEncryptDecrypt.Encrypt(text, Utils.CreateRsaPublicKey(cert2048)); Console.WriteLine(""); Console.WriteLine("-- Encrypted Text --"); Console.WriteLine(encryptedText); var decryptedText = asymmetricEncryptDecrypt.Decrypt(encryptedText, Utils.CreateRsaPrivateKey(cert2048)); Console.WriteLine("-- Decrypted Text --"); Console.WriteLine(decryptedText); }
public EnController(CreateCertificates createCertificates, ImportExportCertificate importExportCertificate, SymmetricEncryptDecrypt symmetricEncryptDecrypt, AsymmetricEncryptDecrypt asymmetricEncryptDecrypt) { _createCertificates = createCertificates; _importExportCertificate = importExportCertificate; _symmetricEncryptDecrypt = symmetricEncryptDecrypt; _asymmetricEncryptDecrypt = asymmetricEncryptDecrypt; }
public EncryptTextModel(SymmetricEncryptDecrypt symmetricEncryptDecrypt, AsymmetricEncryptDecrypt asymmetricEncryptDecrypt, ApplicationDbContext applicationDbContext, ImportExportCertificate importExportCertificate) { _symmetricEncryptDecrypt = symmetricEncryptDecrypt; _asymmetricEncryptDecrypt = asymmetricEncryptDecrypt; _applicationDbContext = applicationDbContext; _importExportCertificate = importExportCertificate; }
public DecryptTextModel(SymmetricEncryptDecrypt symmetricEncryptDecrypt, AsymmetricEncryptDecrypt asymmetricEncryptDecrypt, ApplicationDbContext applicationDbContext, ImportExportCertificate importExportCertificate, DigitalSignatures digitalSignatures, IConfiguration configuration) { _symmetricEncryptDecrypt = symmetricEncryptDecrypt; _asymmetricEncryptDecrypt = asymmetricEncryptDecrypt; _applicationDbContext = applicationDbContext; _importExportCertificate = importExportCertificate; _digitalSignatures = digitalSignatures; _configuration = configuration; }