Results 1 to 5 of 5

Thread: [RESOLVED] Encrypt in Vb6 Decrypt in c#

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2009
    Posts
    5

    Resolved [RESOLVED] Encrypt in Vb6 Decrypt in c#

    Hi,

    I have a VB6 application that should encrypt a string using a public key and a C# application decrypt using a private key.

    Following situation. I created a Certificate containing a public and a private key. in my certstore and exported the keys to files ( .pfx,.cer )

    so basicly i have the methods in vb to decrypt a string but only with .prk and .pbk files but i cant find a way to get the keys stored in the .pfx file out to use them with my crypto api calls.

    So im pretty new to all this crypto stuff and maybe im doing something completley wrong here... so just forgive me if im talking bs here

    thanks in advance
    as

  2. #2

    Thread Starter
    New Member
    Join Date
    Jan 2009
    Posts
    5

    Re: Encrypt in Vb6 Decrypt in c#

    ok i just found ( after hours of googling around ) a much simpler access to my issue using the RSACryptoServiceProvider ... so now i have a much simpler problem: when I encrypt the string and the decrypt it everythings just fine... but if i want to save the encrypted string to a file ( to read the file in my c# app afterwards ) it only saves Questionmarks : "?????????????????????????????????"

    why is that? and much more important... how to avoid that??

  3. #3
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: Encrypt in Vb6 Decrypt in c#

    Maybe you should show us the code you are using to make the file, and to read the file ?

  4. #4

    Thread Starter
    New Member
    Join Date
    Jan 2009
    Posts
    5

    Resolved Re: Encrypt in Vb6 Decrypt in c#

    well it was just a noob failure of mine i forgot to convert the byte array to a string before writing it to a file. anyway im writing it to the database now. everything works fine.

    thanks for your reply anyway

    bye
    as

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Encrypt in Vb6 Decrypt in c#

    Dont forget to Resolve your thread from the "Thread Tools menu > Mark Thread as Resolved" so others will know your question has been answered.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width