Hash Function

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Interested
Rating: 11
Joined: Nov 10, 2011
Company: 1A Software e.U

Hello!

I could not find methodical documentation about HashFunction.SHA256. Could somebody write a few examples?

Thanks!

Lioudmila

 
#2
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Nov 19, 2012
Company:

Code
HashObject = New DataHashing(HashFunction.SHA256);
//First option - get hash fr om the file
HashObject.AppendFile("<path to the file>");
//Second option - get hash from the string
HashObject.Append("My string");
BinaryHash = HashObject.HashSum;

Wh ere BinaryHash is your hash in binary form.
One of the ways to get it as string is to convert it into the Base64 form:
Code
StringRepresentation = Base64String(BinaryHash);

Edited: Alexey Bochkov - Feb 20, 2017 06:47 PM
 
#3
People who like this:0Yes/0No
Active user
Rating: 3
Joined: Mar 10, 2017
Company: Rufinor

Alexey, hello! Please advise how can I run DataHashing class in 1c. There is no such class.

Thank you!
Alex

 
#4
People who like this:0Yes/0No
Timofey Bugaevsky
Guest

Joined:
Company:

Hello, Alex, you should execute the script that Alexey provided on server.

 
#5
People who like this:0Yes/0No
Interested
Rating: 11
Joined: Nov 10, 2011
Company: 1A Software e.U

Hello!

Thank you for the answers!

It ist very useful, but I have more information about this task. The real challenge is reading and writing of signatures using a smart card. This smart card is a chip and is placed in an USB-Stick. The chip looks like in bank cards or sim-cards.

In java there is some library

Code
sun.security.pkcs11.SunPKCS11


I really have no idea how it should work. Additional information that I have is java-technology
Package javax.smartcardio
Java™ Smart Card I/O API

In C++ there are Standard Windows library (winscard).

I can not say more about this subject. Maybe somebody has experience? Or at least if it generally works using 1C?

Thanks a lot in advance!

 
#6
People who like this:0Yes/0No
Timofey Bugaevsky
Guest

Joined:
Company:

Hello, Lioudmila!

Which model of eToken do plan to use?

Usually when you use some equipment with 1C, you need a driver, built as an Add-in. You can use C++ language for example with winscard library to create an add-in.
You can find digital signature examples in 1C:Small Business.
There are some drivers in 1C:Peripheral Equipment Library, maybe they will match your equipment.
Also, there should be a Cryptographic Service Provider installed. The standards of cryptography that they support may also vary.

Hope, this helps.

 
#7
People who like this:0Yes/0No
Interested
Rating: 11
Joined: Nov 10, 2011
Company: 1A Software e.U

Thank you for your answer, Timofey!

This eToken is gemalto.

I have a little bit more information. This chip saves nothing, it just "signs" turnovers.

Regards,

Lioudmila

Edited: Lioudmila Nemtseva - Mar 27, 2017 11:46 AM
 
#8
People who like this:0Yes/0No
Timofey Bugaevsky
Guest

Joined:
Company:

Lioudmila,

Unfortunately, as for now, to use this key, you will have to create an add-in or use third-party application for signing documents.
Please, note that to make signed documents be legally valid, you should use a certified application for signing them. It is good idea to check the EU legislation to make sure that methods that you use produce valid result.

If you are going to create an add-in for signing documents with eToken, maybe you could find some other partners ready for cooperation if declare this in the current topic.

 
#9
People who like this:0Yes/0No
Interested
Rating: 11
Joined: Nov 10, 2011
Company: 1A Software e.U

Hello Timofey!

Thank you for the information! It looks like it must be a very complicated developement. That's why I am considering a possibility of online-signature using HTTPConnection.

Thank you again for great support!

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.