Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/#apmg#cl_strust.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ CLASS /apmg/cl_strust DEFINITION
************************************************************************
PUBLIC SECTION.

CONSTANTS c_version TYPE string VALUE '2.1.1' ##NEEDED.
CONSTANTS c_version TYPE string VALUE '2.2.0' ##NEEDED.

CONSTANTS:
BEGIN OF c_context ##NEEDED,
Expand Down Expand Up @@ -210,7 +210,7 @@ CLASS /apmg/cl_strust IMPLEMENTATION.

" Remove Header and Footer
TRY.
FIND REGEX '-{5}.{0,}BEGIN.{0,}-{5}(.*)-{5}.{0,}END.{0,}-{5}' IN certb64 SUBMATCHES DATA(base64).
FIND REGEX '-{5}.{0,}BEGIN.{0,}-{5}(.*)-{5}.{0,}END.{0,}-{5}' IN certb64 SUBMATCHES DATA(base64) ##REGEX_POSIX.
IF sy-subrc = 0.
ASSIGN base64 TO FIELD-SYMBOL(<data>).
ASSERT sy-subrc = 0.
Expand Down Expand Up @@ -633,9 +633,9 @@ CLASS /apmg/cl_strust IMPLEMENTATION.
IMPORTING
license_number = license_num.

REPLACE '%SID' WITH sy-sysid INTO new_id.
REPLACE '%LIC' WITH license_num INTO new_id.
REPLACE '%ORG' WITH org INTO new_id.
REPLACE '%SID' IN new_id WITH sy-sysid.
REPLACE '%LIC' IN new_id WITH license_num.
REPLACE '%ORG' IN new_id WITH org.
CONDENSE new_id.

subject = new_id.
Expand Down
42 changes: 29 additions & 13 deletions src/#apmg#cl_strust_cert_api.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ CLASS /apmg/cl_strust_cert_api DEFINITION

CLASS-METHODS get_certificates
IMPORTING
!domain TYPE string
!ssl_id TYPE ssfapplssl DEFAULT 'ANONYM'
!debug TYPE abap_bool DEFAULT abap_false
!host TYPE string DEFAULT c_api_host
!endpoint TYPE string DEFAULT c_api_endpoint
!domain TYPE string
!ssl_id TYPE ssfapplssl DEFAULT 'ANONYM'
!debug TYPE abap_bool DEFAULT abap_false
!host TYPE string DEFAULT c_api_host
!endpoint TYPE string DEFAULT c_api_endpoint
!proxy_host TYPE string OPTIONAL
!proxy_service TYPE string OPTIONAL
!proxy_user TYPE string OPTIONAL
!proxy_passwd TYPE string OPTIONAL
RETURNING
VALUE(result) TYPE string
VALUE(result) TYPE string
RAISING
/apmg/cx_error.

Expand All @@ -38,6 +42,10 @@ CLASS /apmg/cl_strust_cert_api DEFINITION
ssl_id TYPE ssfapplssl
host TYPE string
uri TYPE string
proxy_host TYPE string
proxy_service TYPE string
proxy_user TYPE string
proxy_passwd TYPE string
RETURNING
VALUE(result) TYPE REF TO if_http_client
RAISING
Expand Down Expand Up @@ -73,9 +81,13 @@ CLASS /apmg/cl_strust_cert_api IMPLEMENTATION.
query = cl_abap_dyn_prg=>escape_xss_url( query ).

DATA(http_client) = _client(
ssl_id = ssl_id
host = host
uri = |{ endpoint }?domain={ query }| ).
ssl_id = ssl_id
host = host
proxy_host = proxy_host
proxy_service = proxy_service
proxy_user = proxy_user
proxy_passwd = proxy_passwd
uri = |{ endpoint }?domain={ query }| ).

DATA(fetch_response) = _response( http_client ).

Expand All @@ -102,12 +114,16 @@ CLASS /apmg/cl_strust_cert_api IMPLEMENTATION.

cl_http_client=>create_by_url(
EXPORTING
url = host
ssl_id = ssl_id
url = host
ssl_id = ssl_id
proxy_host = proxy_host
proxy_service = proxy_service
proxy_user = proxy_user
proxy_passwd = proxy_passwd
IMPORTING
client = result
client = result
EXCEPTIONS
OTHERS = 99 ).
OTHERS = 99 ).
IF sy-subrc <> 0.
RAISE EXCEPTION TYPE /apmg/cx_error_t100.
ENDIF.
Expand Down
20 changes: 16 additions & 4 deletions src/#apmg#strust_installer.prog.abap
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME TITLE TEXT-t04.
p_endpnt TYPE string OBLIGATORY LOWER CASE.
SELECTION-SCREEN END OF BLOCK b4.

SELECTION-SCREEN BEGIN OF BLOCK b5 WITH FRAME TITLE TEXT-t05.
PARAMETERS:
p_prhost TYPE string LOWER CASE,
p_prport TYPE string LOWER CASE,
p_pruser TYPE string LOWER CASE,
p_prpass TYPE string LOWER CASE.
SELECTION-SCREEN END OF BLOCK b5.

SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE TEXT-t03.
PARAMETERS:
p_passwd TYPE string LOWER CASE,
Expand Down Expand Up @@ -81,10 +89,14 @@ START-OF-SELECTION.

TRY.
DATA(json) = /apmg/cl_strust_cert_api=>get_certificates(
ssl_id = p_ssl_id
domain = p_domain
host = p_host
endpoint = p_endpnt ).
ssl_id = p_ssl_id
domain = p_domain
host = p_host
endpoint = p_endpnt
proxy_host = p_prhost
proxy_service = p_prport
proxy_user = p_pruser
proxy_passwd = p_prpass ).

TRY.
DATA(ajson) = zcl_ajson=>parse( json ).
Expand Down
30 changes: 30 additions & 0 deletions src/#apmg#strust_installer.prog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
<ENTRY>API</ENTRY>
<LENGTH>80</LENGTH>
</item>
<item>
<ID>I</ID>
<KEY>T05</KEY>
<ENTRY>Proxy</ENTRY>
<LENGTH>80</LENGTH>
</item>
<item>
<ID>R</ID>
<ENTRY>Trust Management: Certificate Installer</ENTRY>
Expand Down Expand Up @@ -81,6 +87,30 @@
<ENTRY>Password</ENTRY>
<LENGTH>16</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_PRHOST</KEY>
<ENTRY>Host</ENTRY>
<LENGTH>18</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_PRPASS</KEY>
<ENTRY>Password</ENTRY>
<LENGTH>22</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_PRPORT</KEY>
<ENTRY>Port</ENTRY>
<LENGTH>18</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_PRUSER</KEY>
<ENTRY>User</ENTRY>
<LENGTH>18</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_ROOT</KEY>
Expand Down
22 changes: 17 additions & 5 deletions src/#apmg#strust_updater.prog.abap
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME TITLE TEXT-t04.
p_endpnt TYPE string OBLIGATORY LOWER CASE.
SELECTION-SCREEN END OF BLOCK b4.

SELECTION-SCREEN BEGIN OF BLOCK b5 WITH FRAME TITLE TEXT-t05.
PARAMETERS:
p_prhost TYPE string LOWER CASE,
p_prport TYPE string LOWER CASE,
p_pruser TYPE string LOWER CASE,
p_prpass TYPE string LOWER CASE.
SELECTION-SCREEN END OF BLOCK b5.

SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE TEXT-t03.
PARAMETERS:
p_days TYPE i DEFAULT 30,
Expand Down Expand Up @@ -118,7 +126,7 @@ START-OF-SELECTION.

IF domain NA '.'.
" It's probably a root or intermediate certificate
" Go to their website to
" -> Go to their website to download and install the certificate manually
WRITE /5 'Unable to determine domain of certificate' COLOR COL_TOTAL.
ULINE.
CONTINUE.
Expand All @@ -129,10 +137,14 @@ START-OF-SELECTION.

TRY.
DATA(json) = /apmg/cl_strust_cert_api=>get_certificates(
ssl_id = p_ssl_id
domain = domain
host = p_host
endpoint = p_endpnt ).
ssl_id = p_ssl_id
domain = domain
host = p_host
endpoint = p_endpnt
proxy_host = p_prhost
proxy_service = p_prport
proxy_user = p_pruser
proxy_passwd = p_prpass ).

TRY.
DATA(ajson) = zcl_ajson=>parse( json ).
Expand Down
30 changes: 30 additions & 0 deletions src/#apmg#strust_updater.prog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
<ENTRY>API</ENTRY>
<LENGTH>80</LENGTH>
</item>
<item>
<ID>I</ID>
<KEY>T05</KEY>
<ENTRY>Proxy</ENTRY>
<LENGTH>80</LENGTH>
</item>
<item>
<ID>R</ID>
<ENTRY>Trust Management: Certificate Updater</ENTRY>
Expand Down Expand Up @@ -81,6 +87,30 @@
<ENTRY>Password</ENTRY>
<LENGTH>16</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_PRHOST</KEY>
<ENTRY>Host</ENTRY>
<LENGTH>12</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_PRPASS</KEY>
<ENTRY>Password</ENTRY>
<LENGTH>16</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_PRPORT</KEY>
<ENTRY>Port</ENTRY>
<LENGTH>12</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_PRUSER</KEY>
<ENTRY>User</ENTRY>
<LENGTH>12</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_REMOVE</KEY>
Expand Down