1

I have a java script and want to use it in SQL oracle but don't know how and where to add the 3rd java library in the server.

I found one folder name lib

Is it the right folder or there is another folder I can Idd? which I have the .jar file need to add

I wrote a java code to sign a file from Starkbank library and in order to be able to us the java code I have to add starkbank library java file

import com.starkbank.ellipticcurve.PrivateKey;
import com.starkbank.ellipticcurve.PublicKey;
import com.starkbank.ellipticcurve.Signature;
import com.starkbank.ellipticcurve.Ecdsa;
import com.starkbank.ellipticcurve.Ecdsa;
import com.starkbank.ellipticcurve.PublicKey;
import com.starkbank.ellipticcurve.Signature;
import com.starkbank.ellipticcurve.utils.ByteString;
import com.starkbank.ellipticcurve.utils.File;
import java.util.*;

public class NewClass3{

    public static void main(String[] args){
        
        // Read files
       // String publicKeyPem = File.read("publicKey.pem");
        
        String PrivKeyPem = File.read("ec-secp256k1-priv-key.pem");



      //  PublicKey publicKey = PublicKey.fromPem(publicKeyPem);
       
        PrivateKey privateKey = PrivateKey.fromPem(PrivKeyPem);
        
          
    Base64.Encoder enc = Base64.getEncoder();
        Base64.Decoder dec = Base64.getDecoder();
        
    String str = "LcHeQ9b2bhNW291aOgeXhBHKa1uHmNoKf/ATfX+AJbo=";
  



        // Decode data
        String decoded = new String(dec.decode(str));
        System.out.println("decoded value is \t" + decoded);
        System.out.println("original value is \t" + str);
        


        // Generate Signature
        Signature signature = Ecdsa.sign(decoded, privateKey);

        // Return the signature verification status
        System.out.println("signature: " + signature);

         // Encode into Base64 format - This value should add in QR code

        String base64 = signature.toBase64();
 
        // print encoded String
        System.out.println("Encoded String:\n" + base64);
        
    }
}
MK Said
  • 165
  • 8
  • Do not [delete a question](https://stackoverflow.com/q/74139304/1509264) and then post the same question again. [Edit your original question](https://stackoverflow.com/posts/74139304/edit) to improve it and ask for it to be reopened. – MT0 Oct 20 '22 at 12:38
  • 1
    The title talks about Oracle EBS but the question talks about SQL and it is unclear where you want to use this Java library and what you want to do with it. If you want to add a Jar file to an Java-enabled Oracle RDBMS then use the `loadjava` utility; **NEVER** play with the file structures and try to include it manually through the file system. – MT0 Oct 20 '22 at 12:43
  • @MT0 I edited my post which I mentioned why I need it and what is the java code for, many thanks for your reply, and please how can I use `loadjava` ? – MK Said Oct 20 '22 at 12:56
  • "I have a java script" Please [edit] the question and include the Java script. "and want to use it in SQL oracle" Please [edit] the question and include details of how you want to use it. It is impossible to tell you how to use something when we don't know what it is or how you want to use it. – MT0 Oct 20 '22 at 13:13
  • You still have not told us how you want to use it in Oracle (whether that is EBS or RDBMS is still unclear). Additionally, your Java method returns `void` (i.e. it does not return anything) so using it elsewhere is going to be almost impossible. – MT0 Oct 20 '22 at 15:50
  • @MT0 actually I am fresh on oracle sql, but want to sign the `str` which will come from db and send the output `base64` to store it in db. – MK Said Oct 20 '22 at 15:59

0 Answers0