TO HOW: ??? ???? Visual Basic .NET ????? ????????? ?? Visual Basic ??? Microsoft Office ??????????? ?? ???

???? ?????? ???? ??????
???? ID: 317535 - ?? ???????? ?? ?????? ??? ?? ?? ???? ???? ???? ??.
??? ?? ??????? ???? | ??? ?? ??????? ????

?? ????? ??

??????

??? .NET ????? ????????? ????????? ?? ??? Visual Basic ?? ??? ???? ?? ??? ?? ??? ?? ??? ???????????? ?? ????? ????? ?? ????? ???? ????????? ????????? ?? ??? ??? Visual Basic ????? ?? ???? ???? Visual Basic .NET ????? ????????? ?? ?????????? ?? ?? ???????? ?? ????????? ???? ?? ??? ?????? ??? .NET ??? ????? ?????????????? ????????, ?? ????? ?? ???? ??? Framework, ???????????/?????????? ?? ????

Visual Basic .NET ????? ????????? ?????

  1. Microsoft Visual Studio .NET ???? ????.. ????? ???????????? ??,????? ????-????? ????, ?? ???? ????????????. ?? ???????Visual Basic ???????????? ????????? ?????????. ???? ?? ???CryptoClass?? ????? ????OK. Class1 ?? ???????? ??? ?? ???? ?? ???
  2. ?? ??????? ?? ?????Class1????? ???: ?? ???

    Imports System.Security.Cryptography
    
    <ComClass(Class1.ClassId, Class1.InterfaceId, Class1.EventsId)> Public Class Class1
        Public Const ClassId As String = "98349785-8BE2-4604-848D-F5B103D61715"
        Public Const InterfaceId As String = "36613EE9-125F-493d-9968-771E18C2226A"
        Public Const EventsId As String = "A036F02F-F87E-4548-A536-7DD7EA8E62B5"
    
        Const sKey As String = "MyKey"
    
        Public Function EncryptTripleDES(ByVal sIn As String) As String
            Dim DES As New TripleDESCryptoServiceProvider()
            Dim hashMD5 As New MD5CryptoServiceProvider()
    
            ' Compute the MD5 hash.
            DES.Key = hashMD5.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(sKey))
            ' Set the cipher mode.
            DES.Mode = CipherMode.ECB
            ' Create the encryptor.
            Dim DESEncrypt As ICryptoTransform = DES.CreateEncryptor()
            ' Get a byte array of the string.
            Dim Buffer As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(sIn)
            ' Transform and return the string.
            Return Convert.ToBase64String(DESEncrypt.TransformFinalBlock(Buffer, 0, Buffer.Length))
        End Function
    
        Public Function DecryptTripleDES(ByVal sOut As String) As String
            Dim DES As New TripleDESCryptoServiceProvider()
            Dim hashMD5 As New MD5CryptoServiceProvider()
    
            ' Compute the MD5 hash.
            DES.Key = hashMD5.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(sKey))
            ' Set the cipher mode.
            DES.Mode = CipherMode.ECB
            ' Create the decryptor.
            Dim DESDecrypt As ICryptoTransform = DES.CreateDecryptor()
            Dim Buffer As Byte() = Convert.FromBase64String(sOut)
            ' Transform and return the string.
            Return System.Text.ASCIIEncoding.ASCII.GetString(DESDecrypt.TransformFinalBlock(Buffer, 0, Buffer.Length))
        End Function
    End Class
    						

    ???:?? ClassId, InterfaceId ?? EventsId ?? ??? ??? GUIDs ?? ??????? ???? ?? ??? GUID generator ?? ????? ?? ???? ???? ??? GUIDs ????? ???? ?? ????? ????GUID ?????????? ????????????? ??..
  3. ??????????? ?????? ??????????????? ???. ????? ????,??????? ??? ?? ??? ????COM Interop ?? ??? ?????????? ?????. ????? ????,OK.
  4. ????? ????????????? ??,?????? ?????DLL ??????

.NET ????? ????????? ?? ??? ???? ?? ??? ????????? ?????? ?? ??? ??? Visual Basic ?????

  1. ???????Microsoft Excel. Visual Basic ?????? ??????? ???? ?? ??? ALT+F11 ?????..
  2. ????? ???????????? ???????? ??,??????????? ????? ??????? ???????? ???? ???? ?? ????
  3. ????? ????????????? ??,??????. ???? ?????? ??????CryptoClass????????? ?? ????? ????OK.
  4. ???? ????, ?? Module1 ??? ????? ??? ????? ??? ???????:
    Sub TestCrypto()
      Dim oCrypto As New CryptoClass.Class1
      Dim sCrypt As String
      
      sCrypt = oCrypto.EncryptTripleDES("This is a test")
      MsgBox "Encrypted text = " & sCrypt
      MsgBox "Decrypted text = " & oCrypto.DecryptTripleDES(sCrypt)
    End Sub
    					

??? ?? ??????? ????

  1. ????? ????????????? ??,??????. ?????? ?? ???? ??? ????? ????TestCrypto?? ????-????? ????, ?? ???? ????????.
  2. ??? ???????????? ???????? ?????? ??? ??? ????? ????? ????? ??, ????? ????OK. ??? ????? ????? ????? ????? ???? ?? decrypted ???????? ???? ??? ???
  3. ??? ????? ????????? ?? .NET Framework ?? ??? ???? ???????? ?? ??????? ???? ?? ???????? ??, ?? ?????? DLL ?? ????????? ????? ?? ????? ???? ?????:
    regasm CryptoClass.dll /tlb:CryptoClass.tlb

??????

???????? ??????? ?? ???, Microsoft ?????? ??? ??? ???? ????? ?? ??? ????? ???? ?????? ????? ????::
301070TO HOW: ?????????? ?? Visual Basic .NET ?? ????? ?? ??? ????? ?? ?????????
???? ??????? ?? ???, ????? Microsoft ?????? ??????? (MSDN) ??? ???? ?????:
http://msdn2.microsoft.com/en-us/library/aa188489(office.10).aspx

???

???? ID: 317535 - ????? ???????: 04 ?????? 2010 - ??????: 2.0
???? ???? ???? ??:
  • Microsoft Office Access 2003
  • Microsoft Access 2002 Standard Edition
  • Microsoft Excel 2002 Standard Edition
  • Microsoft Office PowerPoint 2003
  • Microsoft PowerPoint 2002 Standard Edition
  • Microsoft Visual Studio .NET 2003 Professional Edition
  • Microsoft Word 2002
  • Microsoft Visual Studio .NET 2002 Professional Edition
??????: 
kbcrypt kbsecurity kbhowtomaster kbmt KB317535 KbMthi
???? ?????? ????????
??????????: ?? ???? ?? ???? ??????? ?? ????? ?? Microsoft ????-?????? ?????????? ?????? ?????? ???? ??? ??. Microsoft ???? ??? ????-???????? ?? ????-???????? ????? ?????? ?? ???? ???????? ???? ?? ???? ????? ????? ??? ?? ??? ?????? ?? ???? ???? ???? ??? ????? ??. ???????, ????-???????? ???? ????? ???? ???? ???? ???. ?????, ????????, ?????-???? ?? ??????? ?? ???????? ?? ???? ???, ???? ?? ??? ?????? ???? ???? ??? ????? ??? ?? ???? ??. Microsoft ??????? ??? ???? ?? ?????? ?? ??????????, ????????? ?? ??? ?????? ?? ???? ????? ?? ???? ???????? ?? ??? ???? ????? ?? ??? ????????? ???? ??. Microsoft ????-?????? ?????????? ?? ????? ?????? ?? ?? ??? ??.
?????????? ?? ??????? ????????? ??????? ??:317535

??????????? ???

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com