cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 

Encryption using a public key with function SSF_KRN_ENVELOPE

11-18-2024 12:43 PM
Jose_Pablo Newcomer
1384 views 0 comments
0 Likes
SAP Managed Tags
Labels
encryptionpublic key
Subscribe

Hi,

We need to encrypt a KEY, like 

<KEY>290B0B57A7C7AD3D9DF170511C1C9D209DAB1C7F7675D370</KEY>

For this we need to use a public key using algorithm PKCS v1.2., to get a key of 512 hexadecimal characters.

We are trying the following:

* We have defined a new SSF application.

* We have used transaction STRUST to upload the certificate that contains the public key to be used for the encryption.

* We have configured the SSF parameters for this new application:

           HASHALG ==> SHA512

           ENCRALG ==> TRIPLE-DES

* We use functions:

     ==> SSF_GET_PARAMETER(Read certificates included in SSFA)

     ==> SSFC_GET_CERTIFICATELIS (to get  the information of each certificate)

     ==> SSFC_PARSE_CERTIFICATE 

     ==> SSF_KRN_ENVELOPE (to encrypt), here we complete:

ostr_input_data with the string we want to encrypt:<KEY>290B0B57A7C7AD3D9DF170511C1C9D209DAB1C7F7675D370</KEY> 

we are not sure wich value we need to populte field  ostr_input_data_l .Based on method EXTERNAL_ENCYPTING of class CL_PCA_SECURITY, we are applying the same logic:

* preparations
    lv_length         strleniv_card_number ).
* Unicode or Non-unicode systems
    lv_length         lv_length * lv_bytes.

So in our case we are getting: ostr_input_data_l = 118

The function SSF_KRN_ENVELOPE returns ostr_enveloped_data, we have try to apply different conversions to this encrypted data but we get 510 characters instead of 512, so we not sure if we are missing something.

 

 

 

 

 

 

 

 

 

 

 

0 Likes

Accepted Solutions (0)

Answers (0)