phax / as2-lib

A generic Java AS2 library, servlet and server
107 stars 43 forks source link

Cant' send files to distant client using "MainSendToMendelsonTestServer.java" #142

Closed gougos closed 1 year ago

gougos commented 1 year ago

I’m beginner in AS2 transfert and I used your lib for the first time.

I want to send files to distant client(not in the same organisation).

First , I sent the first connection request and i received the client .cer file with their public key. After that ,i created my pair of key to create my .p12 file with openssl .

I generated my config files (« partnership.xml , config.xml,file.p12 »)

Now i can’t have the possibility to send and receive files (error message : « «The receipt was unsigned, and a signed receipt was expected.”)

my two questions are :

i must test the flow (send and receive) in the class "MainSendToMendelsonTestServer.java" or i must test with « MainOpenAS2Server.java »

if i don’t have the private key of the distant server what should i do ?

Thank you very much for your support

phax commented 1 year ago

Hello Hedi,

You have a lot of questions on very diverse topics. I will try give brief answers and you may need to google the missing parts ;-)

Signing means: I give the proof, that this message was created by me. How signing works: you calculate some hash value with YOUR private key, and the receiver can verify the hash value with YOUR public key. NEVER give away your private key.

Encryption means: only the entity with the private key can open the message. How encryption works: you use the public key of the receiver to encrypt the message. The receiver uses his private key to decrypt the message. You NEVER ask for the private key of somebody else :)

In AS2 you can decide if a message is a) "signed and encrypted", b) only signed, c) only encrypted or d) neither signed nor encrypted.

The response to an AS2 message is called MDN - that can be a) signed or b) not signed.

If you send a message that is unsigned, you cannot request an MDN that is signed.

The file "MainSendToMendelsonTestServer" is meant to give you the possibility to test sending to a predefined receiver (a test server offered by Mendelson). You can learn an experiment from a working example.

For sending (if the message should be encrypted) you MUST have the public key of the other side. How you get this is NOT defined in AS2.

The file "MainOpenAS2Server" opens a local AS2 server on your machine. You use this to receive messages (from somebody else).

Hope that gives you a kick-start.

phax commented 1 year ago

Closing this issue due to inactivity