Sabine,

> On 27 Feb 2015, at 16:36, Sabine Manaa <manaa.sab...@gmail.com> wrote:
> 
> Hi Sven, 
> Hi all, 
> 
> I try to send a curl command (which works at command line) from Pharo. 
> I get the error: "SSL Exception: decrypt failed code:5" 
> 
> The working command line command is: 
> 
> curl -v  -H 'Accept: application/json' -u 'aUser:aPassword'
> 'https://user.xxx.net/oauth/token?grant_type=client_credentials'
> 
> the result is something like: 
> {"access_token":"a31xxxa-2a22-4xx6c-938d-2bd3ae4a0629","token_type":"bearer","expires_in":42095,"scope":"write"}
>  
> 
> My current Pharo code is: 
>        | theZnClient | 
>        theZnClient := ZnClient new 
>                systemPolicy ; 
>                https; 
>                host: 'user.xxx.net'; 
>                path: 'oauth/token?grant_type=client_credentials'; 
>                username: 'aUser' password: 'aPassword'; 
>                accept: ZnMimeType applicationJson; 
>                get. 
>        theZnClient inspect close. 
> 
> 'aPassword' and 'aUser' and xxx.net was replaced by me for security reasons. 
> 
> In Pharo, I get a walkback with the error message 
> 'SSL Exception: decrypt failed [code:-5]' 
> 
> But I see, that the ZdcSecureSocketStream has the correct result
> ({"access_token":...":"write"}) in its collection attribute at 
> utf-8 string and at latin1-string 
> 
> so, the request is done and the result is available but then it fails here: 
> ZdcSecureSocketStream(Object)>>error: 
> ZdcSecureSocketStream>>sslException:code: 
> ZdcSecureSocketStream>>fillBytes:startingAt:count: in Block: [ ... 
> ZdcSecureSocketStream>>fillBytes:startingAt:count: 
> ZdcSecureSocketStream(ZdcSimpleSocketStream)>>fillReadBufferNoWait 
> ZdcSecureSocketStream(ZdcSimpleSocketStream)>>fillReadBuffer 
> ZdcSecureSocketStream(ZdcOptimizedSocketStream)>>readInto:startingAt:count: 
> ZnUTF8Encoder>>optimizedReadInto:startingAt:count:fromStream: 
> ZnUTF8Encoder>>readInto:startingAt:count:fromStream: 
> 
> Sven, I could send you the 'aPassword' and 'aUser' and the url by private
> message. It would be fine if you could have a short look at it. 

The fact that there is readable text in the buffer of the ZdcSecureSocketStream 
is good, because it means that things basically work.

One reason why this is failing might be that Zn tries to read more than there 
is available in the stream, when the content-length does not match. Encoding 
problems could be part of the problem too.

Could you compare curl -v or curl -D - output with the request/response headers 
in Pharo ? Look for content-length and compare that with what it already read 
or not. Is the connection kept alive ? Also look at content-type and see if 
there is any charset encoding after application/json.

Sven

> Regards 
> Sabine 
> 
> 
> 
> --
> View this message in context: 
> http://forum.world.st/Zinc-SSL-Exception-decrypt-failed-code-5-tp4808230p4808345.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
> 


Reply via email to