1.源码是一个jar包,主要作用是使用国密SM2算法对http请求进行jwt签名,可提供此jar包,公私钥
2.加解密的案例文本如下:
//公钥
String puk ="04C967E85308E58FED06B1C7040B79EC5E1CA771BA1710599E8A75889F8D476A6F20FA3C6B3F5055F4674EA742583C381D22BAB81412E67B4838B6DDC59F572CB9";
//私钥
String pvk = "7f553f20a6c7e4c6d1be887bf79977556b558e92b9d5f9979992a7d591a3df84";
//明文
String plantxt ="{\"clientId\":\"ab00a83b-7476-4880-8c02-d68350c6f787\",\"scope\":\"\",\"clientSecret\":\"6J5AQ4\",\"grantType\":\"client_credentials\"}";
//签名
String sign ="eyJraWQiOiJhYjAwYTgzYi03NDc2LTQ4ODAtOGMwMi1kNjgzNTBjNmY3ODciLCJ0eXAiOiJKV1QiLCJhbGciOiJTTTIifQ.e30.MzA0NTAyMjEwMGJmOTJiMDg3MzE0NGE0NDlhN2EyYmZmZWM4ZWU1ZDQ5ZWNkZTBmMzA2OThlZmRhYmJlZTAwMGRmNTM5ZTAxODIwMjIwM2IyYWNlNjEwMDcyZjg1ZGJkYTJiOTZiMzFkOWUxOGNlZmEyMmM5MmIwNjY5M2VjMWRjNmY0NDQyMzQxY2MzNg";
// 计算签名JAVA 需引入SDK
String sign1 = SdkSignature.sign( pvk, plantxt);
//输出签名,国密算法基于椭圆算法,每次的签名返回结果都是不一样的
System.out.println(sign1);
//验证上面案例签名
System.out.println(SdkSignature.verifySign(sign, puk, plantxt));
//验证计算的签名
System.out.println(SdkSignature.verifySign(sign1, puk, plantxt));
希望能够将Java语言改写为nodejs,保证调通接口,目前因我方签名错误导致对方系统报错无法进行下去