Forum Discussion

fabio85's avatar
fabio85
Visitor
9 years ago

roRSA in Scene Graph Application

Hi,
we are upgrading our channel to SDK 2.0 (SGS), but we have a big problem. To verify digital signature we used the roRSA and the verify method, but in Scene Graph Application roRSA cannot be used. So which component we have to use to do the same thing of the code down here?
function CheckValidSignature() as Boolean

        ba = CreateObject("roByteArray")
        ba.FromAsciiString(m.resultObjectString)
        
        digest = CreateObject("roEVPDigest")
        digest.Setup("sha256")
        
        hashString = digest.Process(ba)
        hashBA = CreateObject("roByteArray")
        hashBA.FromHexString(hashString)
        rsa = CreateObject("roRSA")

        baSignature=CreateObject("roByteArray") 
        baSignature.FromBase64String(m.signature)
        signature=baSignature
             
        rsa = CreateObject("roRSA")
        rsa.SetPublicKey("pkg:/locale/default/RSA/publicKey.txt")
        rsa.SetDigestAlgorithm("sha256")

        result = rsa.Verify(hashBA, signature)

        if (result = 1)
                
            return true      
            
        end if
   
        return false
end function 

3 Replies

  • roRSA won't run in a Scene or a Task. However, it should work in the Main() thread. In Main(), set up a field observer using a port to listen for changes in some global variable that you can set in your Scene or Task. You should be able to use roRSA in that event-handler, which in turn can set some other global variable to pass the result back to your Scene or Task. I haven't tried this, so I'm just speculating, but I think it's worth a try.
  • "belltown" wrote:
    roRSA won't run in a Scene or a Task. ...

    It doesn't run in a Task?
    Why on god's green earth it won't do that?!
  • "belltown" wrote:
    roRSA won't run in a Scene or a Task. However, it should work in the Main() thread. In Main(), set up a field observer using a port to listen for changes in some global variable that you can set in your Scene or Task. You should be able to use roRSA in that event-handler, which in turn can set some other global variable to pass the result back to your Scene or Task. I haven't tried this, so I'm just speculating, but I think it's worth a try.

    Hi belltown, i resolved creating a field in the scene, to use a function in the Main Thread. Fortunately I needed an asynchronous control.