On 8 March 2010 21:35, Peter Maddin <[email protected]> wrote:

>  Hi Ian
> Thanks for the Code Project link. It looks really great.
>
> I searched CodeProject and did not find this page.
>
> I am fairly certain I have MS Access using my C# COM aware dll.
> I have tested it and it works great.
>
> To morrow I will pass it over to the the person who supports Access at our
> site.
>
> Personally I can't stand Access but they needed a function they could call
> from VBA  to protect passwords that  they
> store in a database table. I though a hash would be easier than a symmetric
> cipher. I tend to shy away using reversible symmetric ciphers within
> insecure code. It is just too easy to bypass most of the security features
> in Access.
>
> Its really just a one off to try and make their access front end
> applications a bit more secure.
>
>
Wasn't MD5 vulnerable to collision attacks?



> Regards Peter.
>
> On 8/03/2010 3:33 PM, Ian Thomas wrote:
>
>  Peter
>
> Did you try the sample code, with Excel? The GUID in the C# or Vb.NET will
> be different for Excel, Access.
>
>
>
> Have a read of this article (CodeProject) for an overview -
> http://www.codeproject.com/KB/COM/cominterop.aspx
>
>
>
>
>  ------------------------------
>
> Ian Thomas
> Victoria Park, Western Australia
>   ------------------------------
>
> *From:* [email protected] [
> mailto:[email protected] <[email protected]>] *On
> Behalf Of *Maddin, Peter
> *Sent:* Monday, 8 March 2010 2:34 PM
> *To:* ozDotNet
> *Subject:* RE: Calling a class library C# method from ms access
>
>
>
> Thanks Ian
>
>
>
> I ma having trouble translating this from Vb.NET to C#.
>
>
>
> I built the class library and then used reflector to see the c# code.
>
> Tried cutting and pasting but the VS Editor did not like it.
>
>
>
> Googling other material, locates code that only vaguely resembles that in
> your link below.
>
>
>
> I am venturing into unchartered territory never having had much to with Com
> before (and being told it was dead)
>
>
>
> The latest one has no GUIDs at all
> http://www.codeproject.com/KB/office/ParallelMsAccess.aspx
>
>
>
> My project is tiny
>
>
>
> using System;
>
> using System.Runtime.InteropServices;
>
> using System.Security.Cryptography;
>
> using System.Text;
>
>
>
> namespace PathWest
>
> {
>
>     [ComVisible(true)]
>
>     public interface HashInterface
>
>     {
>
>         string Md5Hash(string passwordValue);
>
>     }
>
>
>
>     [ComVisible(true)]
>
>     [ClassInterface(ClassInterfaceType.None)]
>
>     public class GetHash : HashInterface
>
>     {
>
>         public string Md5Hash(string passwordValue)
>
>         {
>
>             byte[] hashValue = new MD5CryptoServiceProvider().ComputeHash(
> Encoding.ASCII.GetBytes(passwordValue));
>
>             return Encoding.ASCII.GetString(hashValue);
>
>         }
>
>     }
>
> }
>
>
>
> I do see one in the Assembly.cs file though
>
>
>
> // Setting ComVisible to false makes the types in this assembly not visible
>
>
> // to COM components.  If you need to access a type in this assembly from
>
> // COM, set the ComVisible attribute to true on that type.
>
> [assembly: ComVisible(true)]
>
>
>
> // The following GUID is for the ID of the typelib if this project is
> exposed to COM
>
> [assembly: Guid("b92f832a-3887-412b-a126-e58f35041f2d")]
>
>
>
>
>
>
>
> *Regards Peter Maddin*
> *Applications Development Officer*
> *Path**West Laboratory Medicine WA*
> *Phone : +618 9473 3944*
> *Fax : +618 9473 3982*
> *E-Mail : [email protected]*
> *The contents of this e-mail transmission outside of the WAGHS network are
> intended solely for the named recipient's), may be confidential, and may be
> privileged or otherwise protected from disclosure in the public interest.
> The use, reproduction, disclosure or distribution of the contents of this
> e-mail transmission by any person other than the named recipient(s) is
> prohibited. If you are not a named recipient please notify the sender
> immediately.*
>
>
>
> *From:* [email protected] [
> mailto:[email protected] <[email protected]>] *On
> Behalf Of *Ian Thomas
> *Sent:* Monday, 8 March 2010 11:13 AM
> *To:* 'ozDotNet'
> *Subject:* RE: Calling a class library C# method from ms access
>
>
>
> http://support.microsoft.com/kb/317535
>
>
>  ------------------------------
>
> Ian Thomas
> Victoria Park, Western Australia
>   ------------------------------
>
> *From:* [email protected] [
> mailto:[email protected] <[email protected]>] *On
> Behalf Of *Maddin, Peter
> *Sent:* Monday, 8 March 2010 10:49 AM
> *To:* [email protected]
> *Subject:* Calling a class library C# method from ms access
>
>
>
> I need to call a C# method from MS Access 2003.
>
> I need to pass in a string and return a string.
>
>
>
> I have spent some trying to do this in Delphi but am now sure I need to use
> COM so I might as well use C#.
>
>
>
> I have wasted a couple of days almost getting it working only to find that
> it was too flaky with Access crashing.
>
>
>
> Does anyone have a simple code example they would be willing to share?
>
>
>
> The goal is to pass in a string (which will be a password) and return a
> hash of that string using MD5 or something similar.
>
> Generating the hash is no problem its just writing the class and method so
> Access will be able to call it, setting up the MS Access declaration and
> calling the method passing in a string and returning a string.
>
>
>
> I believe one needs to make the assembly ‘Com-Visible”.
>
> Also the Access declaration needs to specify the TLB and not the dll.
>
> One needs to register the dll (? And tlb) using regasm.
>
>
>
> Is there anything else required?
>
>
>
> *Regards Peter Maddin*
> *Applications Development Officer*
> *Path**West Laboratory Medicine WA*
> *Phone : +618 9473 3944*
> *Fax : +618 9473 3982*
> *E-Mail : [email protected]*
> *The contents of this e-mail transmission outside of the WAGHS network are
> intended solely for the named recipient's), may be confidential, and may be
> privileged or otherwise protected from disclosure in the public interest.
> The use, reproduction, disclosure or distribution of the contents of this
> e-mail transmission by any person other than the named recipient(s) is
> prohibited. If you are not a named recipient please notify the sender
> immediately.*
>
>
>
>


-- 
Meski

"Going to Starbucks for coffee is like going to prison for sex. Sure, you'll
get it, but it's going to be rough" - Adam Hills

Reply via email to