yealoooo opened a new issue, #51147:
URL: https://github.com/apache/doris/issues/51147

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Version
   
    apache-doris-2.1.1
   
   ### What's Wrong?
   
   
   
   execute udf func is error
   
   java.lang.SecurityException: JCE cannot authenticate the provider BC
           at javax.crypto.Cipher.getInstance(Cipher.java:656)
           at javax.crypto.Cipher.getInstance(Cipher.java:595)
           at org.example.DataHandler.sm4Encrypt(DataHandler.java:80)
           at org.example.DataHandler.enc(DataHandler.java:55)
           at org.example.KxEncode.encode(KxEncode.java:39)
           at org.example.KxEncode.evaluate(KxEncode.java:19)
           at org.example.KxEncodeMethodAccess.invoke(Unknown Source)
           at org.apache.doris.udf.UdfExecutor.evaluate(UdfExecutor.java:112)
   Caused by: java.util.jar.JarException: 
file:/opt/module/doris/be/lib/java_extensions/preload-extensions/preload-extensions-jar-with-dependencies.jar
 has unsigned entries - org/apache/arrow/memory/UnsafeAllocationManager.class
           at javax.crypto.JarVerifier.verifySingleJar(JarVerifier.java:502)
           at javax.crypto.JarVerifier.verifyJars(JarVerifier.java:363)
           at javax.crypto.JarVerifier.verify(JarVerifier.java:289)
           at javax.crypto.JceSecurity.verifyProviderJar(JceSecurity.java:164)
           at 
javax.crypto.JceSecurity.getVerificationResult(JceSecurity.java:190)
           at javax.crypto.Cipher.getInstance(Cipher.java:652)
           ... 7 more
   
   
   
   `java`
    import org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPublicKey;
    import org.bouncycastle.jce.provider.BouncyCastleProvider;
    import org.bouncycastle.util.encoders.Hex;
   
    import javax.crypto.Cipher;
    import javax.crypto.spec.SecretKeySpec;
    import java.nio.charset.StandardCharsets;
    import java.security.*;
    import java.security.spec.ECGenParameterSpec;
    import java.util.Base64;
    public class KxDecode extends UDF {
   
        public String evaluate(String value) {
           if (null == value) {
               return "";
           }
           return encode(value);
        }
   
       public static String sm4Encrypt(String plainText, String hexKey) throws 
Exception {
           byte[] keyBytes = hexStringToBytes(hexKey);
           SecretKeySpec keySpec = new SecretKeySpec(keyBytes, SM4_ALGORITHM);
           Cipher cipher = Cipher.getInstance(SM4_TRANSFORMATION, "BC");
           cipher.init(Cipher.ENCRYPT_MODE, keySpec);
           byte[] encrypted = 
cipher.doFinal(plainText.getBytes(StandardCharsets.UTF_8));
           return Base64.getEncoder().encodeToString(encrypted);
        }
   
       public static String sm4Decrypt(String base64CipherText, String hexKey) 
throws Exception {
           byte[] keyBytes = hexStringToBytes(hexKey);
           SecretKeySpec keySpec = new SecretKeySpec(keyBytes, SM4_ALGORITHM);
           Cipher cipher = Cipher.getInstance(SM4_TRANSFORMATION, "BC");
           cipher.init(Cipher.DECRYPT_MODE, keySpec);
           byte[] decrypted = 
cipher.doFinal(Base64.getDecoder().decode(base64CipherText));
           return new String(decrypted, StandardCharsets.UTF_8);
        }
    }
   
   
   
   ### What You Expected?
   
   execute udf func success
   
   ### How to Reproduce?
   
   _No response_
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to