美文网首页
第三方接口绕过签名

第三方接口绕过签名

作者: kany1 | 来源:发表于2018-10-28 18:25 被阅读0次

/**

* 删除

* @param fileId

*/

@Transactional(rollbackFor = AppRuntimeException.class)

@Override

public void del(String fileId,long userId)throws IOException {

Integer user_Id=new Long(userId).intValue();

int row=LiveTapeFileDao.del(fileId,  user_Id);

if(row !=1){

throw  new AppRuntimeException("删除失败"+fileId);

}

String url="v2/index.php";

final ObjectMapper mapper =new ObjectMapper();

String resp =null;

try {

resp = executePost(url ,fileId);

}catch (Exception e) {

e.printStackTrace();

}

logger.info("resp************={}",resp);

LiveTapeFileCodeVO liveTapeFileCodeVO = mapper.readValue(resp, LiveTapeFileCodeVO.class);

if(liveTapeFileCodeVO.getCode() !=0){

throw  new AppRuntimeException("腾讯云录播文件删除失败");

}

logger.info("liveTapeFileCodeVO************={}",liveTapeFileCodeVO);

}

private String executePost(String apiUrl ,String fileId)throws Exception {

logger.debug("api url = {}", apiUrl);

logger.debug("fileId  = {}", fileId);

String Action="DeleteVodFile";

String Region="gz";

String Timestamp =Long.toString(new Date().getTime());

int temp=0;

int[] arr =new int[10];

for(int i=0; i<10; i++){

arr[i] = i +1;

}

Random random =new Random();

int size = arr.length;

for(int k=0; k

int index =0;

if((size -1)-k !=0){

index = random.nextInt((size -1)-k);

}

temp=arr[index];

arr[index] = arr[size - (k +1)];

arr[size - (k +1)] = temp;

}

Integer Nonce=temp;

String SecretId="xxxxxxx";

String Signature="mysignature";

JSONObject JSONObject=new JSONObject();

JSONObject.put("Action",Action);

JSONObject.put("Region",Region);

JSONObject.put("Timestamp",Timestamp);

JSONObject.put("Nonce",Nonce);

JSONObject.put("SecretId",SecretId);

JSONObject.put("Signature",Signature);

logger.info("组件的json"+JSONObject.toString());

try {

final ResponseEntity responseEntity = getRestTemplateBypassingHostNameVerifcation().postForEntity(buildUri(apiUrl,fileId,JSONObject),"{}", String.class);

logger.debug("HTTP status code = {}", responseEntity.getStatusCode());

if (!responseEntity.getStatusCode().is2xxSuccessful()) {

throw new Exception("HTTP请求失败!");

}

return responseEntity.getBody();

}catch (RestClientException e) {

throw new Exception("RestClientException: " + e.getMessage());

}catch (URISyntaxException e) {

throw new Exception("组装请求URL失败!请求未发出");

}

}

public RestTemplate getRestTemplateBypassingHostNameVerifcation() {

CloseableHttpClient httpClient = HttpClients.custom().setSSLHostnameVerifier(new NoopHostnameVerifier()).build();

HttpComponentsClientHttpRequestFactory requestFactory =new HttpComponentsClientHttpRequestFactory();

requestFactory.setHttpClient(httpClient);

return new RestTemplate(requestFactory);

}

private URI buildUri(final String apiUrl, String fileId, JSONObject JSONObject)throws URISyntaxException {

return new URIBuilder()

.setScheme("https")

.setHost("vod.api.qcloud.com")

.setPath(apiUrl)

.setParameter("Action","DeleteVodFile")

.setParameter("fileId",fileId)

.setParameter("priority","0")

.setParameter("COMMON_PARAMS",JSONObject.toString())

.build();

}

相关文章

  • 第三方接口绕过签名

    /** * 删除 * @param fileId */ @Transactional(rollbackFor = ...

  • 拼多多/京东 cps平台的接口

    使用这些第三方的平台接口,第一步一般就是搞签名。签名来来去去也就是那几个算法,其实和微信支付的接口签名比较像,不过...

  • 字典按照key排序后拼接字符串

    我们在对接一些第三方的SDK的接口的时候,通常需要签名,签名方法就是: 将字典类型的参数,按照key的升序排列后,...

  • 签字SDK科普手册

    大多数的企业在使用第三方平台的电子签名系统的同时,会选择通过API接口或是SDK接口来实现到内部系统或应用中去,是...

  • smali代码

    java变量类型对应smali类型 指令: 绕过签名验证

  • laravel 使用jwt方式传递和使用数据

    最近接了不少第三方的支付接口,大部分的支付接口其实差不多,1.构造参数数据,2.请求签名,3.拼接构造数据和签...

  • 接口安全设计-签名机制

    接口安全设计-签名设计 签名设计主要围绕Timestamp和Sign机制展开设计,保证接口的数据不会被篡改。 签名...

  • 微信分享多张图片

    由于微信没有开放分享多张图片的接口给开发者,而产品又想要分享多图,shareSDK第三方分享只有目前做了绕过...

  • Android签名爆破Kstool工具使用

    背景 重打包签名后需要绕过签名校验,可以使用kstoolsGithub: https://github.com/f...

  • 接口签名

    数据签名,主要就是为了防止 数据被 篡改 避免body 只读一次 拦截器 获取参数方法 签名工具 算法 参考微信 ...

网友评论

      本文标题:第三方接口绕过签名

      本文链接:https://www.haomeiwen.com/subject/lolmtqtx.html