Jump to content
Richard_Stevens

Delphi and Java Cryptography Extension (JCE)

Recommended Posts

Hello,

 

I'm trying to access a REST API that apparently uses the Java Cryptography Extension (JCE) over https. I'm having no luck connecting using the REST Debugger so I'm guessing I do actually need to integrate this library somehow.

 

Is this even possible in Delphi, or should I use a different toolset?

 

Thanks

Richard

Share this post


Link to post

That is a bit vague. Do you know how JCE is used to encrypt the REST API? If it's used behind the scenes to perform what is needed for the security of the https protocol, that should get handled by the transport layer.

  • Like 1

Share this post


Link to post

This is the extent of the documentation that is supplied:

 

• HTTPS (Java Cryptography Extension (JCE) is necessary)
• Basic Auth: username + password

 

So I don't really have much to go on. It may be that it's all behind the scenes as you say and it should effectively be handled for me. But I can't seem to get the Rest debugger to get anything meaningful - not even an error message, so I wondered if it was possibly something I had to explicitly handle.

 

Thanks for your reply.

 

Share this post


Link to post

Basic Auth is, if I recall correctly, adding a request header 'Authorization' with a value of 'Basic ' followed by username+':'+password Base64 encoded.

Do you have anything that is calling the API already, running locally, so you could use a browser debugger or Fiddler on and intercept the API call?

Edited by stijnsanders

Share this post


Link to post

We can get data out via the Postman app (https://www.getpostman.com/). This is fine for browsing the structure and seeing what the data looks like.

 

What am I looking for that will help me understand what I need to do in Delphi?

 

Here's a sample header taken from Postman:

 

Date →Fri, 09 Nov 2018 15:00:10 GMT
Content-Type →application/json;charset=UTF-8
Transfer-Encoding →chunked
Connection →keep-alive
Set-Cookie →AWSALB=jAfTXFbbqaRUWZZqgSQn871lc+Zdm1qfE4mR75Zpivsns7Fa/24r++Y4K7jP2ohPpTccySdj7VE5uWh5j0+THr6zFw/Gp1y1B7RXWd1QncyvE/Z1PevyzmwlszgI; Expires=Fri, 16 Nov 2018 15:00:10 GMT; Path=/

 

Sample Response:

{"status":"SUCCESS","data":{"lastUpdated":"2018-05-28T08:06:54Z","dateCreated":"2018-04-24T12:12:44Z","name":"XXX: 2018 - IFRS 16","description":null,"id":737}}

Share this post


Link to post
6 hours ago, stijnsanders said:

That is a bit vague. Do you know how JCE is used to encrypt the REST API? If it's used behind the scenes to perform what is needed for the security of the https protocol, that should get handled by the transport layer.

I agree. JCE is a library for java. https://en.m.wikipedia.org/wiki/Java_Cryptography_Extension so you should not need it. Did you select the correct port?

 

It's to enable SSL when using java. Windows should do it for you, at least on the client side.

Edited by Dany Marmur
Clarification?

Share this post


Link to post

As you both rightly guessed, the JCE was a completely irrelevant.

 

The Delphi REST debugger and components work fine - providing I use an http address not the https one that I needed in Postman. I don't really know why - but it works.

 

Thanks again

Richard

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×