小编Abh*_*988的帖子

Oracle按优先级排序连接

我有一个表,其中定义了父/子关系,但无法通过层次结构级别进行排序。

For example consider this:
   empid  managerid   name 
    js       hd      George
    hd       ab       Mary
    hs       js       Tom
    ab       xx       John
Run Code Online (Sandbox Code Playgroud)

由于我无法使用 ORDER SIBLINGS BY 以分层方式排序,我将如何能够以分层方式对其进行排序,如下所示?

     empid managerid  name 
     ab       xx       John
     hd       ab       Mary
     js       hd      George
     hs       js       Tom
Run Code Online (Sandbox Code Playgroud)

sql oracle connect-by hierarchical-data

0
推荐指数
1
解决办法
2万
查看次数

AES java.security.InvalidAlgorithmParameterException: 错误的 IV 长度:必须是 16 字节长

我试图在我的 Java 应用程序中使用 AES 加密来加密数据。当我运行代码(如下所示)时,我得到:

java.security.InvalidAlgorithmParameterException: Wrong IV length: must be 16 bytes long
    at com.sun.crypto.provider.CipherCore.init(CipherCore.java:525)
    at com.sun.crypto.provider.AESCipher.engineInit(AESCipher.java:346)
    at javax.crypto.Cipher.implInit(Cipher.java:806)
    at javax.crypto.Cipher.chooseProvider(Cipher.java:864)
    at javax.crypto.Cipher.init(Cipher.java:1396)
    at javax.crypto.Cipher.init(Cipher.java:1327)
    at TestEncription.encryptData(TestEncription.java:164)
    at TestEncription.encodeRequest(TestEncription.java:109)
    at TestEncription.main(TestEncription.java:65)
Run Code Online (Sandbox Code Playgroud)

代码:

public String encryptData(String requestData, byte[] sessionKey,
        String messageRefNo) throws Exception {

    SecretKey secKey = new SecretKeySpec(sessionKey, "AES");
    Cipher cipher = Cipher.getInstance(symmetricKeyAlgorithm);
    IvParameterSpec ivSpec = new IvParameterSpec(messageRefNo.getBytes("UTF-8"));
    System.out.println("Seckey: "+secKey);
    cipher.init(Cipher.ENCRYPT_MODE, secKey, ivSpec);
    byte[] newData = cipher.doFinal(requestData.getBytes());

    return Base64.encodeBase64String(newData);
}
Run Code Online (Sandbox Code Playgroud)

这里出了什么问题?

java encryption aes

0
推荐指数
1
解决办法
1万
查看次数

标签 统计

aes ×1

connect-by ×1

encryption ×1

hierarchical-data ×1

java ×1

oracle ×1

sql ×1