Page 1 of 2 1 2 LastLast
Results 1 to 10 of 32

Thread: Data Encryption Business Function

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    New Member smartguru's Avatar
    Join Date
    Mar 2007
    Location
    Makati Philippines
    Posts
    18

    Data Encryption Business Function

    Hi All,
    Anyone here did some business function on how to encrypt the parameter values? for example. Document number will send as input, then the output should be encrypted data. If you have a sample code for that, please send me a copy. I don't have experience in C++ as per the oracle B0800760 BFN is the sample bfn with encryption key, but hard to read for me since a have very minimal idea in C++. If anyone here can give some explanation or sample code with same function and small explanation of each procedures that will be very helpfull for me to solve my problem. btw, we are using E-one 8.10

    Thanks in advance.

    JD Edwards Xe, 8.9/8.11/8.12/9.0
    SQL 2000/2005/2008
    PeopleSoft - People Tool/SQR/SQF/App Engine
    MS Dyanmic AX

  2. #2
    Member
    Join Date
    Aug 2004
    Location
    USA
    Posts
    221

    Re: Data Encryption Business Function

    Tools Release 8.94 has introduced two new APIs jdeEncryptWKey and jdeDecryptWKey to perform encryption and decryption of data using the TripleDES encryption algorithm.

    I checked the API and Business functions guide and found details about the two APIs and examples of usage (attached). Hope that helps.
    Attached Files Attached Files

  3. #3
    New Member smartguru's Avatar
    Join Date
    Mar 2007
    Location
    Makati Philippines
    Posts
    18

    Re: Data Encryption Business Function

    Thanks, this is very usefull.
    JD Edwards Xe, 8.9/8.11/8.12/9.0
    SQL 2000/2005/2008
    PeopleSoft - People Tool/SQR/SQF/App Engine
    MS Dyanmic AX

  4. #4
    Member
    Join Date
    Dec 2000
    Location
    Dallas, TX
    Posts
    148

    Re: Data Encryption Business Function

    Does anyone know what the value of int eVPTripeDES from this sample code is suppose to be?

    type=eEVPTripleDES;

    Thanks
    Rob

  5. #5
    Senior Member craig_welton's Avatar
    Join Date
    Oct 2000
    Location
    Litchfield, CT
    Posts
    1,034

    Re: Data Encryption Business Function

    Based on JDEKDFN.H ...

    enum tagEncryptType {
    eDESInvalidType = 0,
    eEVPTripleDES = 1
    } ;

    so the value is 1
    Craig Welton
    PatWel Group Inc.
    http://www.patwel.com
    Home of the FREE JDE Object Browser, JDETrace, NERDup and BusBuild+ Tools

    E1 9.0 8.98.4.2 Wintel SQL 2008
    E1 9.2 9.2.1.4 iSeries

  6. #6
    Member
    Join Date
    Dec 2000
    Location
    Dallas, TX
    Posts
    148

    Re: Data Encryption Business Function

    Pretty smart. I missed that one.

    One more problem I'm running into. Since I want to create a BSFN that has inputs and outputs and I want to control what to encrypt and decrypt. When the data is encrypted in the BYTE variable. i.e. BYTE EncryptedData.

    How can I move that BYTE variable into a JCHAR variable or vise versa
    jdeStrcpy((BYTE *)(&EncryptedData),
    (JCHAR *) &lpDS->szParameterStringInput);

    Cannot seem to be able to typecast the BYTE var and get a proper compile. I'm missing something since I normally do not work with BYTE Vars.

    Thanks
    Rob

  7. #7
    Hi,
    I have a requirement where i get input a base64 encoded string and need to give back a decoded string. The above bsfn i understand is working with a prt Handle. how can i convert this to work with a string as input and output?

  8. #8
    Senior Member
    Join Date
    Mar 2004
    Location
    Fort Worth, Texas
    Posts
    1,587
    If you are talking about the BSFN above that I attached you would need to write a C BSFN that calls the BSFN above since the BSFN above can only be called by another C BSFN. Then follow the example above. Having said that I think JDE now has its own API calls you can use for encoding/decoding b64 data.

    encodeB64
    decodeB64

    I have not used them since I have always used my BSFN above, but the preferred way would be to use the JDE provided API. Going forward should I ever need to deal with b64 data I would personally use the jde provided APIs.
    Brian Oster
    Application Development Manager
    E1: 9.0 (TR9.1.5.1) / 9.2 (TR9.2.2.2)
    JAS/BSSV: Weblogic 12.1.2 / Weblogic 12.2
    ES: Win2008 / Win2016
    DB: MSSQL 2014 / 2016
    WebDev Client: Win7Pro / Win10Pro

  9. #9
    Is there anyway to find this API for Decode B64 , I searched online couldn't find the exact required I/O details and also searching API's for JDE is a task that never goes in a desired direction. I remember a discussion in JDE list to maintain a API repository, is there anything available like that, would be lot useful.

  10. #10
    Senior Member
    Join Date
    Mar 2004
    Location
    Fort Worth, Texas
    Posts
    1,587
    Quote Originally Posted by ashwin E1 View Post
    Is there anyway to find this API for Decode B64
    I assume you mean documentation? Not sure there is any, but a lot of times you can figure it out from the function signature with a little experimentation or if you are lucky find an example in pristine code. If you have Intellisense working for JDE C BSFN development you can quickly see the function sig. Otherwise just do a text search in the jde system header files for the api call to view the function definition. decodeB64 is defined in jdelprto.h and looks like

    Code:
    LIB_RTN(int)	JDEWINAPI decodeB64(BYTE *pBinaryBuf, int *pnBinaryLen, JCHAR *szB64String);
    Just looking at it I think it would work like the following:

    JCHAR *szB64String
    This is obviously the null terminated base64 string to pass in.

    BYTE *pBinaryBuf, int *pnBinaryLen
    I DONT think decodeB64 allocates the buffer for you otherwise the param would be BYTE **pBinaryBuf. So, I think YOU need to provide a buffer to output the contents to and pass the size of the buffer. But since the size of the buffer (pnBinaryLen) is passed as a pointer, if the buffer and size you pass is too small to hold the data my guess is that decodeB64 doesn't decode the data but instead returns the size of the buffer needed to hold the decode the data in *pnBinaryLen. In fact you may be able to pass NULL and 0 for buf/size along with the string to decode on the first call to get the size of the buffer you need, then allocate the buffer and pass everything in on the second call to actually decode the base64 data to your buffer. Something like:

    Code:
    BYTE  *pMyBuf = (BYTE *)NULL;
    int nBufSize = 0;
    
    decodeB64(NULL, &nBufSize, szBase64StringToDecode);
    pMyBuf = jdeAlloc(COMMON_POOL, nBufSize, MEM_ZEROINIT);
    decodeB64(pMyBuf, &nBufSize, szBase64StringToDecode);
    ...
    jdeFree(pMyBuf);
    This is just a guess based on the function sig. This is where I would start experimenting...

    BTW, just read your question above and it said that the binary data that will be decoded is actually a string so you expect to get a string back. More than likely the sender of the data doesn't care that you are using C so probably does NOT include the null termination char, so your code would probably look like:


    Code:
    ZCHAR  *pMyBuf = (ZCHAR *)NULL;
    int nBufSize = 0;
    
    decodeB64(NULL, &nBufSize, szBase64StringToDecode);
    pMyBuf = jdeAlloc(COMMON_POOL, nBufSize + sizeof(ZCHAR), MEM_ZEROINIT);
    decodeB64((BYTE *)pMyBuf, &nBufSize, szBase64StringToDecode);
    ...
    jdeFree(pMyBuf);
    Last edited by BOster; 11-11-2019 at 07:59 AM.
    Brian Oster
    Application Development Manager
    E1: 9.0 (TR9.1.5.1) / 9.2 (TR9.2.2.2)
    JAS/BSSV: Weblogic 12.1.2 / Weblogic 12.2
    ES: Win2008 / Win2016
    DB: MSSQL 2014 / 2016
    WebDev Client: Win7Pro / Win10Pro

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
The legal restrictions and terms of use applicable to this site are available here.
Use of this site signifies your agreement to the terms of use.
JDELIST is NOT affiliated with JD Edwards® & Company, Oracle or Peoplesoft. Contents of this site are neither endorsed nor approved by JD Edwards® & Company and, or Oracle.