Quantcast
Channel: SCN : Discussion List - PowerBuilder Developer Center
Viewing all articles
Browse latest Browse all 2881

How to fill a PB byte array with negative byte values

$
0
0

Hello Community,

I'm using PB 12.1 6639

 

I have a datatype related problem.

 

I have to AES-encrypt a Byte Array. For encrypting i use a third Party activeX (Crypt2 from Chilkat Software).

 

There is a function byte[] EncryptBytes(Byte data[]).

 

The value i have to crypt is a Long encoded as a signed two complement (big endian) (=Java Long).

 

For example a Long value of 102400 is stored in a Byte Array in that way:

Byte[1] = 1

Byte[2] = -112

Byte[3] = 0

 

And here starts the Trouble. PB's Byte datatype is a unsigned datatype and can hold only positive Byte values.

I also tried using a blob variable instead of a Byte Array (the function EncryptBytes takes it without error), but on Setting up

the data in the blob variable using Setbyte(blob, n, byte)-function there is the same problem that Setbyte only can handle positive Byte values.

 

So the question is how to incorporate negative Byte values into a Byte Array or a blob!

 

Hope somebody can help me.

 

Regards Martin


Viewing all articles
Browse latest Browse all 2881

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>