com.alipay.api.internal.util.AlipayEncrypt Java Examples
The following examples show how to use
com.alipay.api.internal.util.AlipayEncrypt.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultDecryptor.java From alipay-sdk-java-all with Apache License 2.0 | 5 votes |
public String decrypt(String encryptContent, String encryptType, String charset) { String decryptContent = null; try { decryptContent = AlipayEncrypt.decryptContent(encryptContent, encryptType, encryptKey, charset); } catch (AlipayApiException e) { throw new RuntimeException(e); } return decryptContent; }
Example #2
Source File: DefaultEncryptor.java From alipay-sdk-java-all with Apache License 2.0 | 5 votes |
public String encrypt(String sourceContent, String encryptType, String charset) { String encryptContent = null; try { encryptContent = AlipayEncrypt.encryptContent(sourceContent, encryptType, this.encryptKey, charset); } catch (AlipayApiException e) { throw new RuntimeException(e); } return encryptContent; }
Example #3
Source File: EncryptTest.java From alipay-sdk-java-all with Apache License 2.0 | 5 votes |
@Test public void should_get_correct_chipertext() throws AlipayApiException { //given String chipertext = AlipayEncrypt.encryptContent("test1234567", "AES", "aa4BtZ4tspm2wnXLb1ThQA==", "utf-8"); assertThat(chipertext, containsString("ILpoMowjIQjfYMR847rnFQ==")); }
Example #4
Source File: EncryptTest.java From alipay-sdk-java-all with Apache License 2.0 | 5 votes |
@Test public void should_get_correct_plaintext() throws AlipayApiException { //given String plaintext = AlipayEncrypt.decryptContent("ILpoMowjIQjfYMR847rnFQ==", "AES", "aa4BtZ4tspm2wnXLb1ThQA==", "utf-8"); assertThat(plaintext, containsString("test1234567")); }
Example #5
Source File: JsonConverter.java From alipay-sdk with Apache License 2.0 | 5 votes |
/** * @see com.alipay.api.internal.mapping.Converter#encryptSourceData(com.alipay.api.AlipayRequest, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String) */ public String encryptSourceData(AlipayRequest<?> request, String body, String format, String encryptType, String encryptKey, String charset) throws AlipayApiException { ResponseParseItem respSignSourceData = getJSONSignSourceData(request, body); String bodyIndexContent = body.substring(0, respSignSourceData.getStartIndex()); String bodyEndContent = body.substring(respSignSourceData.getEndIndex()); return bodyIndexContent + AlipayEncrypt.decryptContent(respSignSourceData.getEncryptContent(), encryptType, encryptKey, charset) + bodyEndContent; }
Example #6
Source File: XmlConverter.java From alipay-sdk with Apache License 2.0 | 5 votes |
/** * @see com.alipay.api.internal.mapping.Converter#encryptSourceData(com.alipay.api.AlipayRequest, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String) */ public String encryptSourceData(AlipayRequest<?> request, String body, String format, String encryptType, String encryptKey, String charset) throws AlipayApiException { ResponseParseItem respSignSourceData = getXMLSignSourceData(request, body); String bodyIndexContent = body.substring(0, respSignSourceData.getStartIndex()); String bodyEndContent = body.substring(respSignSourceData.getEndIndex()); return bodyIndexContent + AlipayEncrypt.decryptContent(respSignSourceData.getEncryptContent(), encryptType, encryptKey, charset) + bodyEndContent; }
Example #7
Source File: JsonConverter.java From pay with Apache License 2.0 | 5 votes |
/** * @see com.alipay.api.internal.mapping.Converter#encryptSourceData(com.alipay.api.AlipayRequest, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String) */ public String encryptSourceData(AlipayRequest<?> request, String body, String format, String encryptType, String encryptKey, String charset) throws AlipayApiException { ResponseParseItem respSignSourceData = getJSONSignSourceData(request, body); String bodyIndexContent = body.substring(0, respSignSourceData.getStartIndex()); String bodyEndContent = body.substring(respSignSourceData.getEndIndex()); return bodyIndexContent + AlipayEncrypt.decryptContent(respSignSourceData.getEncryptContent(), encryptType, encryptKey, charset) + bodyEndContent; }
Example #8
Source File: XmlConverter.java From pay with Apache License 2.0 | 5 votes |
/** * @see com.alipay.api.internal.mapping.Converter#encryptSourceData(com.alipay.api.AlipayRequest, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String) */ public String encryptSourceData(AlipayRequest<?> request, String body, String format, String encryptType, String encryptKey, String charset) throws AlipayApiException { ResponseParseItem respSignSourceData = getXMLSignSourceData(request, body); String bodyIndexContent = body.substring(0, respSignSourceData.getStartIndex()); String bodyEndContent = body.substring(respSignSourceData.getEndIndex()); return bodyIndexContent + AlipayEncrypt.decryptContent(respSignSourceData.getEncryptContent(), encryptType, encryptKey, charset) + bodyEndContent; }