Class ResponseDecryptUtil


  • public class ResponseDecryptUtil
    extends Object
    • Constructor Detail

      • ResponseDecryptUtil

        public ResponseDecryptUtil()
    • Method Detail

      • decryptStreamChunk

        public static String decryptStreamChunk​(String data,
                                                byte[] key,
                                                byte[] nonce)
                                         throws Exception
        解密流式数据块
        Throws:
        Exception
      • hasValidChoices

        public static boolean hasValidChoices​(Map<String,​Object> chunkData)
        检查chunk数据是否包含有效的choices
      • decryptStreamChoiceContent

        public static void decryptStreamChoiceContent​(Map<String,​Object> choice,
                                                      byte[] key,
                                                      byte[] nonce)
        解密流式choice的内容
      • shouldDecryptStreamChoice

        public static boolean shouldDecryptStreamChoice​(Map<String,​Object> choice)
        检查是否应该解密流式choice
      • getEncryptedContentFromStreamChoice

        public static String getEncryptedContentFromStreamChoice​(Map<String,​Object> choice)
        从流式choice中获取加密内容
      • updateStreamChoiceContent

        public static void updateStreamChoiceContent​(Map<String,​Object> choice,
                                                     String content)
        更新流式choice的内容
      • shouldDecryptChoice

        public static boolean shouldDecryptChoice​(Map<String,​Object> choice)
        判断choice是否需要解密 - 非流式
      • decryptChoiceContent

        public static void decryptChoiceContent​(byte[] key,
                                                byte[] nonce,
                                                Map<String,​Object> choice)
        解密单个choice内容 - 非流式
      • getEncryptedContentFromChoice

        public static String getEncryptedContentFromChoice​(Map<String,​Object> choice)
        从choice获取加密内容 - 非流式