Class ECDSAProvider
Provider of the ECDSA encryption, signatures, verifications, etc.
Inheritance
Inherited Members
Namespace: VEDriversLite.Security
Assembly: VEDriversLite.dll
Syntax
public static class ECDSAProvider
Methods
| Improve this Doc View SourceDecryptBytesWithPrivateKey(Byte[], Key)
Declaration
public static byte[] DecryptBytesWithPrivateKey(byte[] encrypted, Key privateKey)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | encrypted | |
NBitcoin.Key | privateKey |
Returns
Type | Description |
---|---|
System.Byte[] |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | |
System.ArgumentException |
DecryptBytesWithSharedSecret(Byte[], String, BitcoinSecret, String)
Decrypt the bytes with Shared secret
Declaration
public static async Task<(bool, byte[])> DecryptBytesWithSharedSecret(byte[] ebytes, string bobAddress, BitcoinSecret secret, string sharedkey = "")
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | ebytes | Array of the bytes to decrypt |
System.String | bobAddress | Receiver Neblio Address |
NBitcoin.BitcoinSecret | secret | Neblio Private Key of the Sender in the form of BitcoinSecret |
System.String | sharedkey | Shared key from some previous call |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.ValueTuple<System.Boolean, System.Byte[]>> |
DecryptMessage(String, BitcoinSecret)
Decrypt the message with use of the Neblio Private Key
Declaration
public static async Task<(bool, string)> DecryptMessage(string cryptedMessage, BitcoinSecret secret)
Parameters
Type | Name | Description |
---|---|---|
System.String | cryptedMessage | Encrypted Message to decrypt |
NBitcoin.BitcoinSecret | secret | Neblio Private Key in form of BitcoinSecret |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.ValueTuple<System.Boolean, System.String>> |
DecryptMessage(String, String)
Decrypt the message with use of the Neblio Private Key
Declaration
public static async Task<(bool, string)> DecryptMessage(string cryptedMessage, string privateKey)
Parameters
Type | Name | Description |
---|---|---|
System.String | cryptedMessage | Encrypted Message to decrypt |
System.String | privateKey | Neblio Private Key |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.ValueTuple<System.Boolean, System.String>> |
DecryptStringWithPrivateKey(String, Key)
Declaration
public static string DecryptStringWithPrivateKey(string encryptedText, Key privateKey)
Parameters
Type | Name | Description |
---|---|---|
System.String | encryptedText | |
NBitcoin.Key | privateKey |
Returns
Type | Description |
---|---|
System.String |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
DecryptStringWithSharedSecret(String, String, BitcoinSecret, String)
Decrypt the string with Shared secret
Declaration
public static async Task<(bool, string)> DecryptStringWithSharedSecret(string emessage, string bobAddress, BitcoinSecret secret, string sharedkey = "")
Parameters
Type | Name | Description |
---|---|---|
System.String | emessage | Message to decrypt |
System.String | bobAddress | Receiver Neblio Address |
NBitcoin.BitcoinSecret | secret | Neblio Private Key in form of the BitcoinSecret |
System.String | sharedkey | Shared key from some previous call |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.ValueTuple<System.Boolean, System.String>> |
DecryptStringWithSharedSecret(String, String, String)
Decrypt the string with Shared secret
Declaration
public static async Task<(bool, string)> DecryptStringWithSharedSecret(string emessage, string bobAddress, string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | emessage | Message to decrypt |
System.String | bobAddress | Receiver Neblio Address |
System.String | key | Shared secret key |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.ValueTuple<System.Boolean, System.String>> |
DecryptStringWithSharedSecretWithKey(String, String, String)
Dencrypt the string with Shared secret
Declaration
public static async Task<(bool, string)> DecryptStringWithSharedSecretWithKey(string emessage, string bobAddress, string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | emessage | Message to decrypt |
System.String | bobAddress | Receiver Neblio Address |
System.String | key | Shared secret key |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.ValueTuple<System.Boolean, System.String>> |
EncryptBytesWithPublicKey(Byte[], PubKey)
Declaration
public static byte[] EncryptBytesWithPublicKey(byte[] message, PubKey key)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | message | |
NBitcoin.PubKey | key |
Returns
Type | Description |
---|---|
System.Byte[] |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
EncryptBytesWithSharedSecret(Byte[], String, BitcoinSecret, String)
Encrypt the bytes with Shared secret
Declaration
public static async Task<(bool, byte[])> EncryptBytesWithSharedSecret(byte[] inputBytes, string bobAddress, BitcoinSecret secret, string sharedkey = "")
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | inputBytes | Array of the bytes to encrypt |
System.String | bobAddress | Receiver Neblio Address |
NBitcoin.BitcoinSecret | secret | Neblio Private Key of the Sender in the form of BitcoinSecret |
System.String | sharedkey | shared key |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.ValueTuple<System.Boolean, System.Byte[]>> |
EncryptMessage(String, PubKey)
Encrypt the message with use of Public Key
Declaration
public static async Task<(bool, string)> EncryptMessage(string message, PubKey publicKey)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | Message to encrypt |
NBitcoin.PubKey | publicKey | Public Key |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.ValueTuple<System.Boolean, System.String>> |
EncryptMessage(String, String)
Encrypt the message with use of Public Key
Declaration
public static async Task<(bool, string)> EncryptMessage(string message, string publicKey)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | Message to encrypt |
System.String | publicKey | Public Key |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.ValueTuple<System.Boolean, System.String>> |
EncryptStringWithPublicKey(String, PubKey)
Declaration
public static string EncryptStringWithPublicKey(string message, PubKey key)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | |
NBitcoin.PubKey | key |
Returns
Type | Description |
---|---|
System.String |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
EncryptStringWithSharedSecret(String, String, BitcoinSecret, String)
Encrypt the string with Shared secret
Declaration
public static async Task<(bool, string)> EncryptStringWithSharedSecret(string message, string bobAddress, BitcoinSecret secret, string sharedkey = "")
Parameters
Type | Name | Description |
---|---|---|
System.String | message | Message to encrypt |
System.String | bobAddress | Receiver Neblio Address |
NBitcoin.BitcoinSecret | secret | Alice secret |
System.String | sharedkey | shared key |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.ValueTuple<System.Boolean, System.String>> |
EncryptStringWithSharedSecret(String, String, String, String)
Encrypt the string with Shared secret
Declaration
public static async Task<(bool, string)> EncryptStringWithSharedSecret(string message, string bobAddress, string key, string sharedkey = "")
Parameters
Type | Name | Description |
---|---|---|
System.String | message | Message to encrypt |
System.String | bobAddress | Receiver Neblio Address |
System.String | key | Neblio Private Key of the Sender |
System.String | sharedkey | Shared key |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.ValueTuple<System.Boolean, System.String>> |
EncryptStringWithSharedSecretWithKey(String, String, String)
Encrypt the string with Shared secret
Declaration
public static async Task<(bool, string)> EncryptStringWithSharedSecretWithKey(string message, string bobAddress, string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | Message to encrypt |
System.String | bobAddress | Receiver Neblio Address |
System.String | key | Shared secret key |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.ValueTuple<System.Boolean, System.String>> |
GetSharedSecret(String, BitcoinSecret, PubKey)
Obtain the Shared secret based on the Neblio Address and Neblio Private Key
Declaration
public static async Task<(bool, string)> GetSharedSecret(string bobAddress, BitcoinSecret secret, PubKey bobPublicKey = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | bobAddress | Neblio Address of the receiver |
NBitcoin.BitcoinSecret | secret | Private Key of the sender in the form of the BitcoinSecret |
NBitcoin.PubKey | bobPublicKey | Bob public key |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.ValueTuple<System.Boolean, System.String>> |
GetSharedSecret(String, String, PubKey)
Obtain the Shared secret based on the Neblio Address and Neblio Private Key
Declaration
public static async Task<(bool, string)> GetSharedSecret(string bobAddress, string key, PubKey bobPublicKey = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | bobAddress | Neblio Address of the receiver |
System.String | key | Private Key of the sender |
NBitcoin.PubKey | bobPublicKey | Bob public key |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.ValueTuple<System.Boolean, System.String>> |
HMACSHA256(Byte[], Byte[])
Declaration
public static byte[] HMACSHA256(byte[] key, byte[] data)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | key | |
System.Byte[] | data |
Returns
Type | Description |
---|---|
System.Byte[] |
SignMessage(String, BitcoinSecret)
Sign the Message with Neblio Private Key
Declaration
public static async Task<(bool, string)> SignMessage(string message, BitcoinSecret secret)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | Message to sign |
NBitcoin.BitcoinSecret | secret | Neblio Private Key in form of the BitcoinSecret |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.ValueTuple<System.Boolean, System.String>> |
SignMessage(String, String)
Sign the Message with Neblio Private Key
Declaration
public static async Task<(bool, string)> SignMessage(string message, string privateKey)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | Message to sign |
System.String | privateKey | Neblio Private Key |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.ValueTuple<System.Boolean, System.String>> |
VerifyDogeMessage(String, String, String, Boolean)
Verify the Dogecoin message signed by some dogecoin private key
Declaration
public static async Task<(bool, string)> VerifyDogeMessage(string message, string signature, string address, bool messageIsAlreadyHash = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | input original message |
System.String | signature | signature made by some dogecoin address |
System.String | address | Dogecoin address |
System.Boolean | messageIsAlreadyHash | set if the message is already hash compatible for create singature. otherwise it is created hash from the message. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.ValueTuple<System.Boolean, System.String>> |
VerifyMessage(String, String, PubKey, Boolean)
Verify the Neblio message signed by some Neblio Private Key. This function uses the Public Key instead of the Address for the verification
Declaration
public static async Task<(bool, string)> VerifyMessage(string message, string signature, PubKey pubkey, bool messageIsAlreadyHash = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | input original message |
System.String | signature | signature made by some Neblio address |
NBitcoin.PubKey | pubkey | public key of the owner |
System.Boolean | messageIsAlreadyHash | set if the message is already hash compatible for create singature. otherwise it is created hash from the message. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.ValueTuple<System.Boolean, System.String>> |
VerifyMessage(String, String, String, Boolean)
Verify the Neblio message signed by some Neblio private key
Declaration
public static async Task<(bool, string)> VerifyMessage(string message, string signature, string address, bool messageIsAlreadyHash = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | input original message |
System.String | signature | signature made by some Neblio address |
System.String | address | Neblio address |
System.Boolean | messageIsAlreadyHash | set if the message is already hash compatible for create singature. otherwise it is created hash from the message. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.ValueTuple<System.Boolean, System.String>> |