J
Joao Maia
Hi there,
I am a newbie to the security framework of .net and to digital
signatures, and I need some help regarding signing files in .net.
Here's my problem: I have a web application developed in asp.net (with
..net framework 1.1). This web app has a support database and can access
files that are stored on a physical drive in some server (pretty much
any kind of file, although the most accessed are .doc, .xls, .ppt,
..pdf, .tif). What I want to do now is to add some digital signature
functionality to that app. The users must be able to choose a file and
digitally sign it with a certificate stored locally (either on their
machine or in a smartcard, for example). And the signature must be
valid outside my app, for example if any user opens a doc file in Word
directly from its location on the physical disk, Word must still
recognize that the file is signed.
- I need to pass the file from server to client in order to sign it,
since the private key is stored on the certificate, which is on the
client. Since the files can be big, and for performance issues, I think
it's better to pass a hash of the file and sign the hash. Is this
correct ? Does the .net framework provide any way of building a hash
for this purpose ? I've been looking at the HashAlgorithm class and
ComputeHash method. Is this it ?
- I need to sign the file with the certificate on the client side. Here
I'm completely at loss, since I haven't yet found any methods to sign
files or a stream or a byte array with a certificate. I've been
browsing through X509Certificate class, but I've got no clues...
- Finally, after the hash is signed, I need to pass it back to the
server and somehow, to store it with the original file, so that the
signature is recongnized outside my app. Here I'm also at a loss. I
don't even know if there's a way to do this.
So I was wondering if any of you can help me with this problem. I'm not
quite sure if the approach I mentioned is the best one or not. Maybe
there's some easier way to do it, but as I told you, this is new
terrain for me, I've never had to deal with certificates and signatures
before, so I really don't know where to start. Any help on this will be
greatly appreciated.
Thanks in advance.
Cheers from Portugal,
Joao Maia
I am a newbie to the security framework of .net and to digital
signatures, and I need some help regarding signing files in .net.
Here's my problem: I have a web application developed in asp.net (with
..net framework 1.1). This web app has a support database and can access
files that are stored on a physical drive in some server (pretty much
any kind of file, although the most accessed are .doc, .xls, .ppt,
..pdf, .tif). What I want to do now is to add some digital signature
functionality to that app. The users must be able to choose a file and
digitally sign it with a certificate stored locally (either on their
machine or in a smartcard, for example). And the signature must be
valid outside my app, for example if any user opens a doc file in Word
directly from its location on the physical disk, Word must still
recognize that the file is signed.
From my point of view several problems rise here:
- I need to pass the file from server to client in order to sign it,
since the private key is stored on the certificate, which is on the
client. Since the files can be big, and for performance issues, I think
it's better to pass a hash of the file and sign the hash. Is this
correct ? Does the .net framework provide any way of building a hash
for this purpose ? I've been looking at the HashAlgorithm class and
ComputeHash method. Is this it ?
- I need to sign the file with the certificate on the client side. Here
I'm completely at loss, since I haven't yet found any methods to sign
files or a stream or a byte array with a certificate. I've been
browsing through X509Certificate class, but I've got no clues...
- Finally, after the hash is signed, I need to pass it back to the
server and somehow, to store it with the original file, so that the
signature is recongnized outside my app. Here I'm also at a loss. I
don't even know if there's a way to do this.
So I was wondering if any of you can help me with this problem. I'm not
quite sure if the approach I mentioned is the best one or not. Maybe
there's some easier way to do it, but as I told you, this is new
terrain for me, I've never had to deal with certificates and signatures
before, so I really don't know where to start. Any help on this will be
greatly appreciated.
Thanks in advance.
Cheers from Portugal,
Joao Maia