create account

Hive Authentication Services - Microsoft .NET apps integration by arcange

View this thread on: hive.blogpeakd.comecency.com
· @arcange ·
$116.30
Hive Authentication Services - Microsoft .NET apps integration
![](https://i.imgur.com/Opmu4ps.png)

More and more applications integrate [HiveAuth](https://hiveauth.com) as an authentication method.

The major advantage of this integration is that it makes your application usable by all users with a Hive account, both on desktop and mobile.

In addition, HiveAuth avoids users having to provide their private key, which reinforces the feeling of trust in your application.

### Using HiveAuth with Microsoft .NET

Several users have contacted me for advice on integrating HiveAuth into their applications developed with Microsoft.NET languages. One of them was @nathansenn. He already made the HiveAuth integration into @dbuzz but now wanted to be able to use it with [Unity](https://unity.com), a real-time 3D development platform for building 2D and 3D applications, like games and simulations, using .NET and the C# programming language.

It goes without saying that having the possibility for players to authenticate themselves in their favorite games using only their Hive username, without having to provide a password, would be a revolution in the gaming industry and a serious booster for the recognition of our platform.

Although integrating HiveAuth is really child's play thanks to its extensive technical [documentation](https://docs.hiveauth.com), one of the developers who contacted me encountered a major difficulty: the difference in the encryption process between certain programming languages.

### Cross-development-language Encryption can be tricky

> **TLDR;** HiveAuth relies heavily on encryption to secure its protocol. The method used to encrypt data in JavaScript (the programming language used by HiveAuth and Keychain) did not have a .NET equivalent.

To perform encryption/decryption, HiveAuth relies on the [AES encryption specification](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard) and uses two functions from the CryptoJS library:

`const encrypted = CryptoJS.AES.encrypt(message, password);` 
and
`const decrypted = CryptoJS.AES.decrypt(encrypted, password);`

Pretty simple, isn't it?

Not quite, because to perform encryption AES does not require a password, but an encryption key (key) AND an initialization vector (iv). You can read more about it on [this page](https://knowledgeburrow.com/what-is-aes-key-and-iv/).

However, as you can see in the code above, CryptoJS does not use a key/IV pair but a simple "password". The trick is that CryptoJs derives a 32-byte long encryption key for AES-256 and a 16-byte long initialization vector (iv) from the "password", then encrypts the "Message" using this key and iv. So, technically speaking, the "password" is not really a password or encryption key but rather a seed.

And the problems arise when you realize that the .NET encryption libraries don't provide similar functionality!

So I had to dig into the articles on cryptography and the internet to learn more, understand how it works and recreate a library in C# that reproduces the behavior of the library in JavaScript. 

This work will not have been useless because hardly had I finished my friend @brianoflondon contacted me, facing the same problem in his work of integrating HiveAuth into one of his projects written in Python.

### .NET HiveAuth integration is (now) really easy

If you are a .NET developer, you can now use a "CryptoJS" class I created that you can easily integrate into your own projects. You can then do the following, just like JavaScript developers

`string encrypted = CryptoJS.Encrypt(message, password);`
and
`string decrypted = CryptoJS.Decrypt(encrypted, password);`

To facilitate the work of .NET developers, I provide them with an example of HiveAuth integration in a very simple C# Windows Application project.

The CryptoJS.cs class and demo project are open-source and available on [Github](https://github.com/hiveauth/hive-auth-dotnet). 
The project contains a (very) simple app with just a login form:

![](https://i.imgur.com/6on4iGw.png)

After entering your username and clicking on the button, it will display a QR code that you can scan with Keychain Mobile

![](https://i.imgur.com/KSnRtS1.png)

You just have to open Keychain, scan the code and approve the authentication request. Keychain will then display an approval form where you can accept or decline the authentication request:

![](https://i.imgur.com/4OsDtpF.png)

If you approve the authentication, Keychain will confirm it and send the authentication approval to the application.

![](https://i.imgur.com/OEOwsWr.png)

The application then receives this confirmation with a session token that will allow it to later interact with the HiveAuth node to send transaction requests.

![](https://i.imgur.com/YrZ491k.png)

Thanks to this concise example, it will only be easier for any .NET developer to integrate HiveAuth as an authentication method in their applications.

### Source code, documentation and support

As mentioned at the beginning of the article, the source code for this sample, as well as other sample codes and libraries you can use to make your job easier, is available on [Github](https://github.com/hiveauth).

The [HAS documentation](https://docs.hiveauth.com) has been updated with references to this new example.

Finally, if you need help integrating HiveAuth into your (d)Apps, support is provided on [discord](https://discord.gg/Tk5dkAgQPh)

---
<center>

### Check out my apps and services
<a href="/hive/@hive.engage/stay-connected-with-your-hive-audience-and-catch-attention"><img src="https://i.imgur.com/GiNJqlm.png"></a><a href="/@hivebuzz"><img src="https://i.imgur.com/B4UTun2.png"></a><a href="/@hivesql"><img src="https://i.imgur.com/EPN8RW6.png"></a><a href="https://hiveauth.com"><img src="https://i.imgur.com/2Ws6KzW.png"></a><a href="/hive/@arcange/introducing-hive-account-recovery"><img src="https://i.imgur.com/6TWeW7V.png"></a><a href="/@hive.autoclaim"><img src="https://i.imgur.com/ih2pEOw.png"></a></center>
<center>

### [Vote for me as a witness ![](https://i.imgur.com/2bi4SnT.png)](https://vote.hive.uno/@arcange)
</center>
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 208 others
👎  , ,
properties (23)
authorarcange
permlinkhiveauth-update-dotnet
categoryhive-139531
json_metadata"{"app":"peakd/2023.1.1","format":"markdown","description":"Check out how easy integrating HiveAuth into your Microsoft .NET applications is with this simple code example.","tags":["hive-139531","hiveauth","has","hive","authentication","services","blockchain","decentralized","leofinance"],"users":["nathansenn.","dbuzz","brianoflondon","hive.engage","hivebuzz","hivesql","arcange","hive.autoclaim"],"image":["https://i.imgur.com/Opmu4ps.png","https://i.imgur.com/6on4iGw.png","https://i.imgur.com/KSnRtS1.png","https://i.imgur.com/4OsDtpF.png","https://i.imgur.com/OEOwsWr.png","https://i.imgur.com/YrZ491k.png","https://i.imgur.com/GiNJqlm.png","https://i.imgur.com/B4UTun2.png","https://i.imgur.com/EPN8RW6.png","https://i.imgur.com/2Ws6KzW.png","https://i.imgur.com/6TWeW7V.png","https://i.imgur.com/ih2pEOw.png","https://i.imgur.com/2bi4SnT.png"]}"
created2023-01-15 15:43:45
last_update2023-01-15 15:43:45
depth0
children12
last_payout2023-01-22 15:43:45
cashout_time1969-12-31 23:59:59
total_payout_value58.174 HBD
curator_payout_value58.121 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length6,080
author_reputation1,065,065,779,136,773
root_title"Hive Authentication Services - Microsoft .NET apps integration"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id119,900,399
net_rshares217,945,000,829,524
author_curate_reward""
vote details (275)
@dzoji ·
!LUV
properties (22)
authordzoji
permlinkre-arcange-2023115t181513508z
categoryhive-139531
json_metadata{"tags":["hive-139531","hiveauth","has","hive","authentication","services","blockchain","decentralized","leofinance"],"app":"ecency/3.0.35-mobile","format":"markdown+html"}
created2023-01-15 17:11:51
last_update2023-01-15 17:11:51
depth1
children1
last_payout2023-01-22 17:11:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length4
author_reputation36,598,066,526,026
root_title"Hive Authentication Services - Microsoft .NET apps integration"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id119,902,281
net_rshares0
@luvshares ·
@arcange, @dzoji<sub>(1/1)</sub> sent you LUV. | <a
    href="https://crrdlx.websavvy.work/" style="text-decoration:none">tools</a> | <a 
    href="https://discord.gg/K5GvNhcPqR" style="text-decoration:none">discord</a> | <a href="https://peakd.com/c/hive-159259">community | <a 
    href="https://crrdlx.websavvy.work/wiki/doku.php?id=start" style="text-decoration:none">HiveWiki</a> | <a href="https://peakd.com/nftforpeace/@hivebuzz/nft-for-peace" target="_blank"><img src="https://files.peakd.com/file/peakd-hive/crrdlx/Epvkqd2sQEjZxu93x3A2J2fztKDarTY17qgMbpqWRV14NrfNBA6fu1jxtTkZztjXZKo.gif" target="_blank"></a> <a href="https://peakd.com/nftforpeace/@hivebuzz/nft-for-peace" target="_blank">NFT</a> | <a href="https://ichthys.netlify.app" style="text-decoration:none"><>< daily</a>
<center>Made with <a href="https://peakd.com/@luvshares" target="_blank"><img src="https://files.peakd.com/file/peakd-hive/crrdlx/AKKSsM8HYHY5o4R1UPRdUADTz5QpsKAxSH5uyxsK4k1AJz5wsBqm7TfvA8aSCjE.png"></a> by <a href="https://hive.blog/@crrdlx" target="_blank">crrdlx</a></center>
properties (22)
authorluvshares
permlinkre-re-arcange-2023115t181513508z-20230115t171209z
categoryhive-139531
json_metadata"{"app": "beem/0.24.26"}"
created2023-01-15 17:12:09
last_update2023-01-15 17:12:09
depth2
children0
last_payout2023-01-22 17:12:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,067
author_reputation5,179,581,555,731
root_title"Hive Authentication Services - Microsoft .NET apps integration"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id119,902,286
net_rshares0
@guruvaj ·
❤️❤️💪🏼❤️❤️
properties (22)
authorguruvaj
permlinkre-arcange-2023116t74411496z
categoryhive-139531
json_metadata{"tags":["hive-139531","hiveauth","has","hive","authentication","services","blockchain","decentralized","leofinance"],"app":"ecency/3.0.35-mobile","format":"markdown+html"}
created2023-01-15 23:44:12
last_update2023-01-15 23:44:12
depth1
children0
last_payout2023-01-22 23:44:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length10
author_reputation42,675,890,964,090
root_title"Hive Authentication Services - Microsoft .NET apps integration"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id119,910,864
net_rshares0
@hivebuzz ·
Congratulations @arcange! You received a personal badge!

<table><tr><td>https://images.hive.blog/70x70/http://hivebuzz.me/badges/lpud.png</td><td>You powered-up at least 150 LEO on Leo Power Up Day!<br>Thank you for participating in the Leo Power Up day.</td></tr></table>

<sub>_You can view your badges on [your board](https://hivebuzz.me/@arcange) and compare yourself to others in the [Ranking](https://hivebuzz.me/ranking)_</sub>


**Check out our last posts:**
<table><tr><td><a href="/hive-122221/@hivebuzz/lpud-202301"><img src="https://images.hive.blog/64x128/https://i.imgur.com/pVZi2Md.png"></a></td><td><a href="/hive-122221/@hivebuzz/lpud-202301">LEO Power Up Day - January 15, 2023</a></td></tr><tr><td><a href="/hive-199963/@hivebuzz/meetup-graz"><img src="https://images.hive.blog/64x128/https://i.imgur.com/5KV6zT3.png"></a></td><td><a href="/hive-199963/@hivebuzz/meetup-graz">HiveBuzz supports meetups of the Hive Austrian Community in Graz</a></td></tr><tr><td><a href="/hive-139531/@hivebuzz/proposal-2324"><img src="https://images.hive.blog/64x128/https://i.imgur.com/RNIZ1N6.png"></a></td><td><a href="/hive-139531/@hivebuzz/proposal-2324">The Hive Gamification Proposal Renewal</a></td></tr></table>
properties (22)
authorhivebuzz
permlinknotify-arcange-20230116t002521
categoryhive-139531
json_metadata{"image":["http://hivebuzz.me/notify.t6.png"]}
created2023-01-16 00:25:21
last_update2023-01-16 00:25:21
depth1
children0
last_payout2023-01-23 00:25:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,224
author_reputation367,970,446,675,611
root_title"Hive Authentication Services - Microsoft .NET apps integration"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id119,911,657
net_rshares0
@louis88 ·
$0.10
Thanks for the development! A Auth. inside Unity brings a huge step forward to have a secure and smoothly way to sign in - In Games made in Unity or other Desktop-Applications!

Thanks - Great Job!
👍  ,
properties (23)
authorlouis88
permlinkre-arcange-rokmi7
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2023.1.1"}
created2023-01-16 09:03:42
last_update2023-01-16 09:03:42
depth1
children1
last_payout2023-01-23 09:03:42
cashout_time1969-12-31 23:59:59
total_payout_value0.052 HBD
curator_payout_value0.052 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length197
author_reputation913,013,981,044,380
root_title"Hive Authentication Services - Microsoft .NET apps integration"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id119,919,208
net_rshares200,586,805,735
author_curate_reward""
vote details (2)
@arcange ·
$1.07
Thank you @louis88. Hopefully this encourages more developers to use our blockchain as a means of authentication.
👍  ,
properties (23)
authorarcange
permlinkre-louis88-rokvhs
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2023.1.1"}
created2023-01-16 12:17:51
last_update2023-01-16 12:17:51
depth2
children0
last_payout2023-01-23 12:17:51
cashout_time1969-12-31 23:59:59
total_payout_value0.536 HBD
curator_payout_value0.536 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length113
author_reputation1,065,065,779,136,773
root_title"Hive Authentication Services - Microsoft .NET apps integration"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id119,922,561
net_rshares2,003,565,986,266
author_curate_reward""
vote details (2)
@mightyrocklee ·
I read it, above my paygrade. HuH!
properties (22)
authormightyrocklee
permlinkrojuo6
categoryhive-139531
json_metadata{"app":"hiveblog/0.1"}
created2023-01-15 23:02:30
last_update2023-01-15 23:02:30
depth1
children0
last_payout2023-01-22 23:02:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length34
author_reputation56,043,267,098,320
root_title"Hive Authentication Services - Microsoft .NET apps integration"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id119,910,073
net_rshares0
@pixresteemer ·
<center>![pixresteemer_incognito_angel_mini.png](https://files.peakd.com/file/peakd-hive/pixresteemer/8h7BBw1w-pixresteemer_incognito_angel_mini.png)</center><center>Bang, I did it again... I just rehived your post!</center><center>Week 138 of my [contest](/hive-179017/@pixresteemer/the-re-hive-contest-results-week-137-and-start-week-138) just started...you can now check the winners of the previous week!</center><center><sub>10</sub></center>
properties (22)
authorpixresteemer
permlink20230115t155135194z
categoryhive-139531
json_metadata{"tags":["archon","alive","cent","hive-engine","pob","pimp","ctp","waiv","hustler"],"app":"pixresteemer"}
created2023-01-15 15:51:36
last_update2023-01-15 15:51:36
depth1
children0
last_payout2023-01-22 15:51:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length446
author_reputation121,071,247,750,144
root_title"Hive Authentication Services - Microsoft .NET apps integration"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id119,900,552
net_rshares0
@sagarkothari88 ·
.NET is solved. Thank you so much. I wish I could have something handy for Dart code. 
At the moment, in order to integrate HAS, I am bridging Dart <=> Javascript code.
It's working & that's what I've illustrated in my these demos

- https://ecency.com/hive-181335/@sagarkothari88/tjebadlezs
- https://ecency.com/hive-181335/@sagarkothari88/qnxdntoaik 
👍  , , , ,
properties (23)
authorsagarkothari88
permlinkre-arcange-2023116t02439817z
categoryhive-139531
json_metadata{"tags":["hive-139531","hiveauth","has","hive","authentication","services","blockchain","decentralized","leofinance"],"app":"ecency/3.0.30-vision","format":"markdown+html"}
created2023-01-15 18:54:39
last_update2023-01-15 18:54:39
depth1
children1
last_payout2023-01-22 18:54:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length353
author_reputation267,030,449,246,300
root_title"Hive Authentication Services - Microsoft .NET apps integration"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id119,904,473
net_rshares29,106,553,105
author_curate_reward""
vote details (5)
@arcange ·
I saw your video, but I don't know enough about flutter and dart, and if it would require similar encryption/decryption tool to bypass the bridge you put in place.
properties (22)
authorarcange
permlinkre-sagarkothari88-rojr2w
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2023.1.1"}
created2023-01-15 21:45:15
last_update2023-01-15 21:45:15
depth2
children0
last_payout2023-01-22 21:45:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length163
author_reputation1,065,065,779,136,773
root_title"Hive Authentication Services - Microsoft .NET apps integration"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id119,908,490
net_rshares0
@spiritsurge ·
Finally...well done...this is badly needed...
properties (22)
authorspiritsurge
permlinkre-arcange-roldch
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2023.1.1"}
created2023-01-16 18:43:30
last_update2023-01-16 18:43:30
depth1
children1
last_payout2023-01-23 18:43:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length45
author_reputation6,851,672,074,927
root_title"Hive Authentication Services - Microsoft .NET apps integration"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id119,931,446
net_rshares0
@arcange ·
Thank you @spiritsurge<div><a href="https://engage.hivechain.app">![](https://i.imgur.com/XsrNmcl.png)</a></div>
properties (22)
authorarcange
permlinkre-1673899362816
categoryhive-139531
json_metadata{"app":"engage"}
created2023-01-16 20:02:42
last_update2023-01-16 20:02:42
depth2
children0
last_payout2023-01-23 20:02:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length112
author_reputation1,065,065,779,136,773
root_title"Hive Authentication Services - Microsoft .NET apps integration"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id119,933,263
net_rshares0