Bike-Routes-MTP / SAP-Next-Gen-Biking

iOS app that collects locations of bicycling users in order to plan new bike routes
0 stars 2 forks source link

agreement password security #12

Open loberste opened 7 years ago

loberste commented 7 years ago

hash algorithm:

create profie:

login:

edit profile:

loberste commented 7 years ago

@inf2381 do you think this is a good practice? Because we thought about this being higher security by not sending the password plain via web requests

inf2381 commented 7 years ago

Common practise is to add a "salt" to the hash. My instructor for IT-Security suggested the following website: https://crackstation.net/hashing-security.htm

loberste commented 7 years ago

Okay cool! Should we take this extension? https://github.com/krzyzanowskim/CryptoSwift Salt function is even implemented :-)

horsson commented 7 years ago

Hi, The CryptoSwift is good to use. As there're huge stars on it. If the server is configured with TLS/SSL, sending password/hash value isn't a problem, as the communication is encrypted.

horsson commented 7 years ago

By the way, if you have TLS setup on the server side, it should be better transport the password directly to the server instead of doing hash on the client side. Just image that, if you have another type of client, you should implement the hash again and again.

loberste commented 7 years ago

Cool! Thank you, @horsson ! That means if the encrypted communication is safe, we could do it like: @BartoszWilkusz is the connection TLS/SSL encrypted?

To Store a Password

To Validate a Password

horsson commented 7 years ago

Hi @loberste , Please have a look at a nice article: https://crackstation.net/hashing-security.htm

BartoszWilkusz commented 7 years ago

Following the documentation https://help.sap.com/viewer/6b94445c94ae495c83a19646e7c3fd56/2.0.00/en-US/d33b259c567441aa97e99228dc0f2088.html I don't have the role sap.hana.xs.wdisp.admin::WebDispatcherAdmin to access the configuration.

But we are using https for communication with Hana, so it should have at least SSL, right?

horsson commented 7 years ago

yes. SAP Cloud Platform offers you the security infrastructure

BartoszWilkusz commented 7 years ago

I have a technical question about sha256 hashing in xsjs and SAP Hana. In this exclusive "documentation" about the crypto namespace, we have the choice between MD5, sha1 and sha256. We will use sha256.

When using the API, i get an ArrayBuffer as a result. Does someone has a hint how i can compare hashed password? Because something like this dosn't work (hashBool is still false):

var hashBool = false;
var hashedPassword = $.security.crypto.sha256(user.password);
var secondhashed = $.security.crypto.sha256(user.password);
if (hashedPassword === secondhashed) {
      hashBool = true;
}

Another point is, how i store an ArrayBuffer in the database? What is the right data type? Is it VARBINARY? SHA256 is always 256 bits long, equivalent to 32 bytes, or 64 bytes in an hexadecimal string format. I will try this solution.

Sorry for the lack of skill. I searched about this, but couldn't resolve the problem.

Thanks!

horsson commented 7 years ago

Hi, It seems that hashedPassword and secondhashed are the type of ArrayBuffer. The === comparison will compare the reference of the two objects. Please searching for "ArrayBuffer comparison" on google.