EGA-archive / ega-data-api

Apache License 2.0
2 stars 3 forks source link

HEX conversions in RES #90

Closed blankdots closed 5 years ago

blankdots commented 5 years ago

Description

This is related to crypt4gh header in the Database it is stored as HEX, however RES expected bytes, moreover when decrypting the header in parseHeader function the header is decrypted and the session key and IV are encoded into base64 but the LocalEGAServiceImpl expects Hex via getInputStream ... and this creates a confusion, of encoding and decoding.

Can we operate with just HEX for now or base64. - don't care much about the format let us just agree on one and use it. A solution is proposed in https://github.com/EGA-archive/ega-data-api/blob/test/m4/ega-data-api-res/src/main/java/eu/elixir/ega/ebi/reencryptionmvc/service/internal/LocalEGAArchiveServiceImpl.java

Definition of Done

Allow RES to process headers as HEX strings from db, indifferent of the programming language of encoding. Proper error handling, as now it is difficult to spot where the header was not properly decrypted and why.

How to test

Unit test and integration tests added for headers that match the desired format and those that don't.

juhtornr commented 5 years ago

@dtitov @AlexanderSenf @anandmohan777 you are the ones that have implemented this so can you agree on the format and then make the implementation to follow one format?

dtitov commented 5 years ago

I vote for using HEX everywhere: Base64 can contain some characters which are not URL-friendly, while HEX-string is always URL-friendly.