Hash Function



The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Interested
Rating: 10
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:1Yes/0No
Active user
Rating: 6
Joined: Nov 19, 2012
Company: BizzSimple.com

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
Just came
Rating: 0
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
Administrator
Rating: 100
Joined: Jul 20, 2011
Company: 1C Company

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

1C Company support team
 
#5
People who like this:0Yes/0No
Interested
Rating: 10
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
Administrator
Rating: 100
Joined: Jul 20, 2011
Company: 1C 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.

1C Company support team
 
#7
People who like this:0Yes/0No
Interested
Rating: 10
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
Administrator
Rating: 100
Joined: Jul 20, 2011
Company: 1C 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.

1C Company support team
 
#9
People who like this:0Yes/0No
Interested
Rating: 10
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