OE 10.2B Decrypt Error with AppServer

Posted by dfranken on 24-Jan-2012 02:29

Fellow PSDN users,

We have a problem with the internal Decrypt() function in combination with the AppServer.

This Decrypt function gives an error on incorrect data, but any attempt to catch the error fails when used with the AppServer.

Our own Decrypt method is as follows:

method public character DecryptInfo (to-decrypt as character).<br>
    def var cresult as char   no-undo init ''. <br>

    def var mb64    as memptr no-undo.<br>
    def var mdecr   as memptr no-undo.<br><br>
   
    if to-decrypt = ? then return ''.<br><br>
   
    do on error undo, throw:<br>
      assign<br>
        mb64    = base64-decode(to-decrypt).<br>
        mdecr   = decrypt(mb64).<br>
        cresult = string(mdecr).<br>
        .<br><br>
   
      return cresult.<br>
    end.<br><br>
   
    catch eSys as Progress.Lang.SysError:<br>
      return ''.<br>
    end catch.<br><br>
   
    catch e as Progress.Lang.Error:<br>
      return ''.<br>
    end catch.<br><br>
   
    finally:<br>
      set-size(mb64)  = 0.<br>
      set-size(mdecr) = 0.<br>
    end finally.<br><br>
   
  end.<br><br>

If I use this method in a normal program which is run from for instance OE Architect through prowin32.exe, no error is thrown and I get empty values for data that can't be encrypted. This is the expected behavior.

If the method is invoked through the AppServer, this message appears over and over: DECRYPT   error:0606506D:digital envelope routines:EVP_DecryptFinal_ex:wrong final block length:

Is there any way to catch this error properly so the AppServer leaves it alone? I've tried all sorts of combinations, including adding no-error and such, but the hard system error keeps appearing.

All Replies

Posted by rbf on 24-Jan-2012 02:35

Maybe this is a STOP condition. The only way to catch that is with the ON STOP phrase.

Posted by dfranken on 24-Jan-2012 02:37

I'll try adding the Stop.

But it's weird how a regular program that uses the same method will show no errors, but the AppServer will.

And the method is used in a loop which is still completed, even with errors shown.

Posted by rbf on 24-Jan-2012 02:58

I agree.

And since you have an easily reproducable case you should certainly log it with Tech Support.

Posted by Peter Judge on 24-Jan-2012 08:41

dfranken wrote:

Fellow PSDN users,

We have a problem with the internal Decrypt() function in combination with the AppServer.

This Decrypt function gives an error on incorrect data, but any attempt to catch the error fails when used with the AppServer.

Our own Decrypt method is as follows:

method public character DecryptInfo (to-decrypt as character).
    def var cresult as char   no-undo init ''.
    def var mb64    as memptr no-undo.
    def var mdecr   as memptr no-undo.

        if to-decrypt = ? then return ''.

        do on error undo, throw:
      assign
        mb64    = base64-decode(to-decrypt).
        mdecr   = decrypt(mb64).
        cresult = string(mdecr).
        .

          return cresult.
    end.

        catch eSys as Progress.Lang.SysError:
      return ''.
    end catch.

        catch e as Progress.Lang.Error:
      return ''.
    end catch.

        finally:
      set-size(mb64)  = 0.
      set-size(mdecr) = 0.
    end finally.

      end.

If I use this method in a normal program which is run from for instance OE Architect through prowin32.exe, no error is thrown and I get empty values for data that can't be encrypted. This is the expected behavior.

If the method is invoked through the AppServer, this message appears over and over: DECRYPT   error:0606506D:digital envelope routines:EVP_DecryptFinal_ex:wrong final block length:

Is there any way to catch this error properly so the AppServer leaves it alone? I've tried all sorts of combinations, including adding no-error and such, but the hard system error keeps appearing.

I'll second the suggestions to report this to TS. Also, how does the .P catch the errors? Does it have a ROUTINE-LEVEL ON ERROR UNDO, THROW statement? You should be able to catch the SysError.

-- peter

This thread is closed