Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
fabio85
Level 7

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 
0 Kudos
3 Replies
belltown
Level 7

Re: roRSA in Scene Graph Application

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.
https://github.com/belltown/
0 Kudos
EnTerr
Level 8

Re: roRSA in Scene Graph Application

"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?!
0 Kudos
fabio85
Level 7

Re: roRSA in Scene Graph Application

"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.
0 Kudos