C# Class ServiceStack.RsaUtils

Useful .NET Encryption Utils from: https://msdn.microsoft.com/en-us/library/system.security.cryptography.rsacryptoserviceprovider(v=vs.110).aspx
Afficher le fichier Open project: ServiceStack/ServiceStack Class Usage Examples

Méthodes publiques

Свойство Type Description
DefaultKeyPair RsaKeyPair
DoOAEPPadding bool
KeyLength RsaKeyLengths

Méthodes publiques

Méthode Description
Authenticate ( byte dataToSign, RSAParameters privateKey, string hashAlgorithm = "SHA512", RsaKeyLengths rsaKeyLength = RsaKeyLengths.Bit2048 ) : byte[]
CreatePrivateKeyParams ( RsaKeyLengths rsaKeyLength = RsaKeyLengths.Bit2048 ) : RSAParameters
CreatePublicAndPrivateKeyPair ( RsaKeyLengths rsaKeyLength = RsaKeyLengths.Bit2048 ) : RsaKeyPair
Decrypt ( byte encryptedBytes, RSAParameters privateKey, RsaKeyLengths rsaKeyLength = RsaKeyLengths.Bit2048 ) : byte[]
Decrypt ( byte encryptedBytes, string privateKeyXml, RsaKeyLengths rsaKeyLength = RsaKeyLengths.Bit2048 ) : byte[]
Decrypt ( string encryptedText, RSAParameters privateKey, RsaKeyLengths rsaKeyLength = RsaKeyLengths.Bit2048 ) : string
Decrypt ( string encryptedText, string privateKeyXml, RsaKeyLengths rsaKeyLength = RsaKeyLengths.Bit2048 ) : string
Decrypt ( this text ) : string
Encrypt ( byte bytes, RSAParameters publicKey, RsaKeyLengths rsaKeyLength = RsaKeyLengths.Bit2048 ) : byte[]
Encrypt ( byte bytes, string publicKeyXml, RsaKeyLengths rsaKeyLength = RsaKeyLengths.Bit2048 ) : byte[]
Encrypt ( string text, RSAParameters publicKey, RsaKeyLengths rsaKeyLength = RsaKeyLengths.Bit2048 ) : string
Encrypt ( string text, string publicKeyXml, RsaKeyLengths rsaKeyLength = RsaKeyLengths.Bit2048 ) : string
Encrypt ( this text ) : string
FromPrivateRSAParameters ( this privateKey ) : string
FromPublicRSAParameters ( this publicKey ) : string
ToPrivateKeyXml ( this privateKey ) : string
ToPrivateRSAParameters ( this privateKeyXml ) : RSAParameters
ToPublicKeyXml ( this publicKey ) : string
ToPublicRSAParameters ( this publicKeyXml ) : RSAParameters
ToPublicRsaParameters ( this privateKey ) : RSAParameters
Verify ( byte dataToVerify, byte signature, RSAParameters publicKey, string hashAlgorithm = "SHA512", RsaKeyLengths rsaKeyLength = RsaKeyLengths.Bit2048 ) : bool

Private Methods

Méthode Description
CreateRsa ( RsaKeyLengths rsaKeyLength ) : RSA

Method Details

Authenticate() public static méthode

public static Authenticate ( byte dataToSign, RSAParameters privateKey, string hashAlgorithm = "SHA512", RsaKeyLengths rsaKeyLength = RsaKeyLengths.Bit2048 ) : byte[]
dataToSign byte
privateKey RSAParameters
hashAlgorithm string
rsaKeyLength RsaKeyLengths
Résultat byte[]

CreatePrivateKeyParams() public static méthode

public static CreatePrivateKeyParams ( RsaKeyLengths rsaKeyLength = RsaKeyLengths.Bit2048 ) : RSAParameters
rsaKeyLength RsaKeyLengths
Résultat RSAParameters

CreatePublicAndPrivateKeyPair() public static méthode

public static CreatePublicAndPrivateKeyPair ( RsaKeyLengths rsaKeyLength = RsaKeyLengths.Bit2048 ) : RsaKeyPair
rsaKeyLength RsaKeyLengths
Résultat RsaKeyPair

Decrypt() public static méthode

public static Decrypt ( byte encryptedBytes, RSAParameters privateKey, RsaKeyLengths rsaKeyLength = RsaKeyLengths.Bit2048 ) : byte[]
encryptedBytes byte
privateKey RSAParameters
rsaKeyLength RsaKeyLengths
Résultat byte[]

Decrypt() public static méthode

public static Decrypt ( byte encryptedBytes, string privateKeyXml, RsaKeyLengths rsaKeyLength = RsaKeyLengths.Bit2048 ) : byte[]
encryptedBytes byte
privateKeyXml string
rsaKeyLength RsaKeyLengths
Résultat byte[]

Decrypt() public static méthode

public static Decrypt ( string encryptedText, RSAParameters privateKey, RsaKeyLengths rsaKeyLength = RsaKeyLengths.Bit2048 ) : string
encryptedText string
privateKey RSAParameters
rsaKeyLength RsaKeyLengths
Résultat string

Decrypt() public static méthode

public static Decrypt ( string encryptedText, string privateKeyXml, RsaKeyLengths rsaKeyLength = RsaKeyLengths.Bit2048 ) : string
encryptedText string
privateKeyXml string
rsaKeyLength RsaKeyLengths
Résultat string

Decrypt() public static méthode

public static Decrypt ( this text ) : string
text this
Résultat string

Encrypt() public static méthode

public static Encrypt ( byte bytes, RSAParameters publicKey, RsaKeyLengths rsaKeyLength = RsaKeyLengths.Bit2048 ) : byte[]
bytes byte
publicKey RSAParameters
rsaKeyLength RsaKeyLengths
Résultat byte[]

Encrypt() public static méthode

public static Encrypt ( byte bytes, string publicKeyXml, RsaKeyLengths rsaKeyLength = RsaKeyLengths.Bit2048 ) : byte[]
bytes byte
publicKeyXml string
rsaKeyLength RsaKeyLengths
Résultat byte[]

Encrypt() public static méthode

public static Encrypt ( string text, RSAParameters publicKey, RsaKeyLengths rsaKeyLength = RsaKeyLengths.Bit2048 ) : string
text string
publicKey RSAParameters
rsaKeyLength RsaKeyLengths
Résultat string

Encrypt() public static méthode

public static Encrypt ( string text, string publicKeyXml, RsaKeyLengths rsaKeyLength = RsaKeyLengths.Bit2048 ) : string
text string
publicKeyXml string
rsaKeyLength RsaKeyLengths
Résultat string

Encrypt() public static méthode

public static Encrypt ( this text ) : string
text this
Résultat string

FromPrivateRSAParameters() public static méthode

public static FromPrivateRSAParameters ( this privateKey ) : string
privateKey this
Résultat string

FromPublicRSAParameters() public static méthode

public static FromPublicRSAParameters ( this publicKey ) : string
publicKey this
Résultat string

ToPrivateKeyXml() public static méthode

public static ToPrivateKeyXml ( this privateKey ) : string
privateKey this
Résultat string

ToPrivateRSAParameters() public static méthode

public static ToPrivateRSAParameters ( this privateKeyXml ) : RSAParameters
privateKeyXml this
Résultat RSAParameters

ToPublicKeyXml() public static méthode

public static ToPublicKeyXml ( this publicKey ) : string
publicKey this
Résultat string

ToPublicRSAParameters() public static méthode

public static ToPublicRSAParameters ( this publicKeyXml ) : RSAParameters
publicKeyXml this
Résultat RSAParameters

ToPublicRsaParameters() public static méthode

public static ToPublicRsaParameters ( this privateKey ) : RSAParameters
privateKey this
Résultat RSAParameters

Verify() public static méthode

public static Verify ( byte dataToVerify, byte signature, RSAParameters publicKey, string hashAlgorithm = "SHA512", RsaKeyLengths rsaKeyLength = RsaKeyLengths.Bit2048 ) : bool
dataToVerify byte
signature byte
publicKey RSAParameters
hashAlgorithm string
rsaKeyLength RsaKeyLengths
Résultat bool

Property Details

DefaultKeyPair public_oe static_oe property

public static RsaKeyPair,ServiceStack DefaultKeyPair
Résultat RsaKeyPair

DoOAEPPadding public_oe static_oe property

public static bool DoOAEPPadding
Résultat bool

KeyLength public_oe static_oe property

public static RsaKeyLengths KeyLength
Résultat RsaKeyLengths