본문 바로가기
개발자 커뮤니티에 오신 것을 환영합니다!

기타 [vb.net] 암호화/복호화(Encrypt / Decrypt)

페이지 정보

profile_image
작성자 하나를하더라도최선을
댓글 0건 조회 44,535회 작성일 20-09-22 23:34

본문

    '// 복호화
    Public Function Decrypt(ByVal cipherText As String, Optional key As String = ""As String
        If key.Length = 0 Then key = Application.ProductName
        Dim wrapper As New Simple3Des(key)
        Try
            Return wrapper.DecryptData(cipherText)
        Catch ex As System.Security.Cryptography.CryptographicException
            'MsgBox("The data could not be decrypted with the password.")
        End Try
        Return Nothing
    End Function
 
    '// 암호화
    Public Function Encrypt(ByVal plaintext As String, Optional key As String = ""As String
        If key.Length = 0 Then key = Application.ProductName
        Dim wrapper As New Simple3Des(key)
        Dim cipherText As String = wrapper.EncryptData(plaintext)
        Return cipherText
    End Function
 


댓글목록

등록된 댓글이 없습니다.


Copyright © program1472 | IT HUB. All rights reserved.