C# Class Com.Aurora.Shared.Helpers.Crypto.CryptoHelper

Mostra file Open project: aurora-lzzp/Aurora-Weather

Public Methods

Method Description
CipherDecryption ( string strAlgName, Windows.Storage.Streams.IBuffer buffEncrypt, BinaryStringEncoding encoding, CryptographicKey key, Windows.Storage.Streams.IBuffer iniVec = null ) : string

对一段 Buffer 根据指定的算法和密钥解密,如果使用 CBC 算法,还需要初始化向量

CipherEncryption ( string content, string strAlgName, BinaryStringEncoding encoding, CryptographicKey key, Windows.Storage.Streams.IBuffer iniVec = null ) : Windows.Storage.Streams.IBuffer

对字符串依据指定的算法和密钥进行加密,如果使用 CBC 算法,还需要初始化向量

GenerateCBCVector ( string strAlgName ) : Windows.Storage.Streams.IBuffer

生成 CBC 算法初始化向量

GenerateKey ( string strAlgName, uint keyLength ) : CryptographicKey

根据加密算法和长度生成一个对称密钥,现在尚不能导出密钥

ProtectAsync ( string strMsg, string strDescriptor, BinaryStringEncoding encoding ) : Task
ToString ( BinaryStringEncoding encoding, Windows.Storage.Streams.IBuffer buff ) : string
UnprotectAsync ( Windows.Storage.Streams.IBuffer buffProtected, BinaryStringEncoding encoding ) : Task

Method Details

CipherDecryption() public static method

对一段 Buffer 根据指定的算法和密钥解密,如果使用 CBC 算法,还需要初始化向量
public static CipherDecryption ( string strAlgName, Windows.Storage.Streams.IBuffer buffEncrypt, BinaryStringEncoding encoding, CryptographicKey key, Windows.Storage.Streams.IBuffer iniVec = null ) : string
strAlgName string 算法
buffEncrypt Windows.Storage.Streams.IBuffer 加密缓冲区
encoding BinaryStringEncoding 编码方式
key Windows.Security.Cryptography.Core.CryptographicKey 密钥
iniVec Windows.Storage.Streams.IBuffer 初始化向量
return string

CipherEncryption() public static method

对字符串依据指定的算法和密钥进行加密,如果使用 CBC 算法,还需要初始化向量
public static CipherEncryption ( string content, string strAlgName, BinaryStringEncoding encoding, CryptographicKey key, Windows.Storage.Streams.IBuffer iniVec = null ) : Windows.Storage.Streams.IBuffer
content string 源字符串
strAlgName string 加密算法
encoding BinaryStringEncoding 字符串编码方式
key Windows.Security.Cryptography.Core.CryptographicKey 密钥
iniVec Windows.Storage.Streams.IBuffer CBC 初始化向量
return Windows.Storage.Streams.IBuffer

GenerateCBCVector() public static method

生成 CBC 算法初始化向量
public static GenerateCBCVector ( string strAlgName ) : Windows.Storage.Streams.IBuffer
strAlgName string
return Windows.Storage.Streams.IBuffer

GenerateKey() public static method

根据加密算法和长度生成一个对称密钥,现在尚不能导出密钥
public static GenerateKey ( string strAlgName, uint keyLength ) : CryptographicKey
strAlgName string 算法
keyLength uint 密钥长度
return Windows.Security.Cryptography.Core.CryptographicKey

ProtectAsync() public static method

public static ProtectAsync ( string strMsg, string strDescriptor, BinaryStringEncoding encoding ) : Task
strMsg string
strDescriptor string
encoding BinaryStringEncoding
return Task

ToString() public static method

public static ToString ( BinaryStringEncoding encoding, Windows.Storage.Streams.IBuffer buff ) : string
encoding BinaryStringEncoding
buff Windows.Storage.Streams.IBuffer
return string

UnprotectAsync() public static method

public static UnprotectAsync ( Windows.Storage.Streams.IBuffer buffProtected, BinaryStringEncoding encoding ) : Task
buffProtected Windows.Storage.Streams.IBuffer
encoding BinaryStringEncoding
return Task