通過Sapphire Encrypt utility,您可以在您的移動通訊設(shè)備上加密和解密純文本內(nèi)容。您可以用指定密碼密鑰進(jìn)行加密,并在設(shè)備驅(qū)動器或者服務(wù)器上解密,反之亦然。
The Sapphire Encrypt utility allows you to encrypt and decrypt both plain text and files on you mobile devices. You can simply encrypt the data by using a specified key and decrypt it on another device or server, or visa-versa.
通過以下功能,Sapphire Encrypt Utility可以輕松得進(jìn)行數(shù)據(jù)加密:
- 使用指定的密碼密鑰對文本字符進(jìn)行加密
- 使用指定的密碼密鑰對文本字符進(jìn)行解密
- 使用指定的密碼密鑰對文件進(jìn)行加密
- 使用指定的密碼密鑰對文件進(jìn)行解密
實例代碼 該操作是如此簡單的,您只需在您的程序中聲明相應(yīng)的DLL函數(shù),然后在您需要的地方調(diào)用即可。以下是一個VB.NET的示范程序,用于演示如何對純文本字符進(jìn)行加密和解密。
- 加密文本
Dim sEncrypted As Integer
Dim sNew As String
' Fill sNew to force the string variable to a sufficient size for the returned string
sNew = Space(1000)
sEncrypted = sEncryptText(txtOriginal.Text, sNew, txtPassword.Text, _
1234567890, True)
txtEncrypted.Text = StripString(sNew)
If sEncrypted = 0 Then
MsgBox("Encrypted")
Else
MsgBox("Problem")
End If - 解密文本
Dim sDecrypted As Integer
Dim sNew As String
' Fill sNew to force the string variable to a sufficient size for the returned string
sNew = Space(1000)
sDecrypted = sDecryptText(txtEncrypted.Text, sNew, txtPassword.Text, _
1234567890, True)
txtDecrypted.Text = StripString(sNew)
If sDecrypted = 0 Then
MsgBox("Decrypted")
Else
MsgBox("Problem")
End If
The Sapphire Encrypt Utility makes data encryption easy by providing the following functionality:
- Encrypt a plain text string using a specified key
- Decrypt a plain text string specifying the key
- Encrypt a file using a specified key
- Decrypt a file using a specified key
Sample Code
Implementation couldn’t be easier, simply declare the DLL function as a function within your application and call it as though you wrote it yourself. Here’s a sample demo on how to encrypt and decrypt a simple text string within VB.NET.
- Encrypting Text
Dim sEncrypted As Integer
Dim sNew As String
' Fill sNew to force the string variable to a sufficient size for the returned string
sNew = Space(1000)
sEncrypted = sEncryptText(txtOriginal.Text, sNew, txtPassword.Text, _
1234567890, True)
txtEncrypted.Text = StripString(sNew)
If sEncrypted = 0 Then
MsgBox("Encrypted")
Else
MsgBox("Problem")
End If
- Decrypting Text
Dim sDecrypted As Integer
Dim sNew As String
' Fill sNew to force the string variable to a sufficient size for the returned string
sNew = Space(1000)
sDecrypted = sDecryptText(txtEncrypted.Text, sNew, txtPassword.Text, _
1234567890, True)
txtDecrypted.Text = StripString(sNew)
If sDecrypted = 0 Then
MsgBox("Decrypted")
Else
MsgBox("Problem")
End If