Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
C# file in use
Message
De
04/12/2014 05:17:04
 
 
À
04/12/2014 04:55:23
Information générale
Forum:
ASP.NET
Catégorie:
Visual Studio
Titre:
Versions des environnements
Environment:
C# 5.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01611725
Message ID:
01611767
Vues:
25
>>>>>Hi
>>>>>
>>>>>I'm creating a console app to pgp decrypt some files.
>>>>>
>>>>>This works but when I try and rename the second (and last) file that is decrypted I get an error file in use message.
>>>>>
>>>>>This is the code before I try and rename the file
>>>>>
>>>>>
>>>>>if (fileexists)
>>>>>            {
>>>>>
>>>>>                PGPDecrypt CES_ConCurDecrypt = new PGPDecrypt(CES_PGPEncryptedFile,
>>>>>                                                 @PGPPrivateKeyFile,
>>>>>                                                 PGPPassword,
>>>>>                                                 @PGPOutPutPath,
>>>>>                                                 @PGPPublicKeyFile);
>>>>>
>>>>>                FileStream CES_fs = File.Open(CES_PGPEncryptedFile, FileMode.Open);
>>>>>
>>>>>                CES_ConCurDecrypt.decrypt(CES_fs, @PGPOutPutPath);
>>>>>
>>>>>                CES_fs.Close();
>>>>>
>>>>>            }
>>>>>
>>>>>
>>>>>How can I tell what has the output file still open .
>>>>>
>>>>>Thanks
>>>>>
>>>>>Update
>>>>>
>>>>> I solved my problem by add a stream.dispose() in the decryption routine but I'd still like to know in Visual Studio how can I tell what still had the file open ?
>>>>
>>>>I think you can only do it thru code (and only find the process responsible) : http://stackoverflow.com/questions/860656/using-c-how-does-one-figure-out-what-process-locked-a-file
>>>>
>>>>BTW - best practice is to use "using (stream.......)" which will take care of the dispose() for you (even if there's an exception in the block).
>>>
>>>Thanks Viv. At the moment I'm dealing with a pointy headed person who might not let the bouncycastle dll onto his server.
>>
>>:-{
>>
>>What are his arguments ?
>
>From his email.
>
>Does PGP not provide a dll that does this instead of using a third-party?

I wonder who he means by 'PGP' - IIRC the original Zimmerman company has ended up as part of Symantec ?

> Are you able to review the source code to make sure there is no hidden functionality?

You can review the source - but it would take a *lot* of reviewing to fullfill that requirement :-}
If you were encrypting then, although I'm sure it's not the case, there could be some 'back-door' way of accessing the encrypted file.
OTOH, if you are just using it for decryption what could be the problem ?

>Can you upload the DLL to virus total to make sure no one has flagged it as a malicious file? If there are any updates to the dll then we will need to be alerted or monitor notice boards.

You shouldn't have a problem with that....
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform