@@ -9,13 +9,12 @@ namespace SeqCli.Encryptor;
99
1010class ExternalDataProtector : IDataProtector
1111{
12- public ExternalDataProtector ( SeqCliEncryptionProviderConfig providerConfig )
12+ public ExternalDataProtector ( string encryptor , string ? encryptorArgs , string decryptor , string ? decryptorArgs )
1313 {
14- _encryptor = providerConfig . Encryptor ! ;
15- _encryptorArgs = providerConfig . EncryptorArgs ;
16-
17- _decryptor = providerConfig . Decryptor ! ;
18- _decryptorArgs = providerConfig . DecryptorArgs ;
14+ _encryptor = encryptor ?? throw new ArgumentNullException ( nameof ( encryptor ) ) ;
15+ _encryptorArgs = encryptorArgs ;
16+ _decryptor = decryptor ?? throw new ArgumentNullException ( nameof ( decryptor ) ) ;
17+ _decryptorArgs = decryptorArgs ;
1918 }
2019
2120 readonly string _encryptor ;
@@ -28,7 +27,7 @@ public byte[] Encrypt(byte[] unencrypted)
2827 var exit = Invoke ( _encryptor , _encryptorArgs , unencrypted , out var encrypted , out var err ) ;
2928 if ( exit != 0 )
3029 {
31- throw new Exception ( $ "Encryptor failed with exit code { exit } and produced: { err } ") ;
30+ throw new Exception ( $ "Encryptor failed with exit code { exit } and produced: { err } . ") ;
3231 }
3332
3433 return encrypted ;
@@ -39,7 +38,7 @@ public byte[] Decrypt(byte[] encrypted)
3938 var exit = Invoke ( _decryptor , _decryptorArgs , encrypted , out var decrypted , out var err ) ;
4039 if ( exit != 0 )
4140 {
42- throw new Exception ( $ "Decryptor failed with exit code { exit } and produced: { err } ") ;
41+ throw new Exception ( $ "Decryptor failed with exit code { exit } and produced: { err } . ") ;
4342 }
4443
4544 return decrypted ;
@@ -50,6 +49,7 @@ static int Invoke(string fullExePath, string? args, byte[] stdin, out byte[] std
5049 var startInfo = new ProcessStartInfo
5150 {
5251 UseShellExecute = false ,
52+ RedirectStandardInput = true ,
5353 RedirectStandardError = true ,
5454 RedirectStandardOutput = true ,
5555 WindowStyle = ProcessWindowStyle . Hidden ,
0 commit comments