-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for generating inputs dealing with RSA encryption. #1154
Comments
hi @ytfrank , |
Thanks for your info. |
hi @ytfrank |
Here is an OpenAPI example:
Encryption Process
AES(json parameters)
Base64(AES(json parameters))
Base64(RSA(AES KEY)) After completing the above steps, we obtain the encrypted business parameters and secret key. Finally, these encrypted business parameter values are added to the system parameters. Signature Process
appId=123&key=a¶ms=encryptData{"a":"b"}×tamp=1&version=1.0
SHA1WithRSA(appId=123&key=a¶ms=encryptData{"a":"b"}×tamp=1&version=1.0)
Base64URLSafe(SHA1WithRSA(appId=123&key=a¶ms=encryptData{"a":"b"}×tamp=1&version=1.0)) After completing the above three steps, we obtain the signature of the business parameters. Finally, the signature value is added to the system parameter sign=Base64URLSafe(SHA1WithRSA(appId=123&key=a¶ms=encryptData{"a":"b"}×tamp=1&version=1.0)) I hope there will be a mechanism to inform EM how to prepare specific data during initialization, and the specific implementation is coded by the user. |
hi @ytfrank , thanks for the explanation. Adding a feature to support this would be possible. So yes, it is technically possible to add such feature. But, without APIs to use for experiments requiring such feature (e.g., open-source on GitHub, or in academia-industry collaborations), in all honesty it would be hard to prioritize this feature compared to other pressing ones :( |
Thanks for your reply. The openapi doc can be seen from http://localhost:8080/v3/api-docs after the app starts. openapi: 3.0.1
|
A classic scenario is that the other party first encrypts the data, signs all the business parameters with its own RSA private key, and then puts the value of this signature into the parameter "sign". Therefore, after receiving the request in the API, it will first verify whether the "sign" in the input parameters is correct and then decrypt it. If any step is wrong, API will return and the later codes can not be covered.
One example of verifying the sign:
// java.security.Signature
public static boolean verify(byte[] data, byte[] sign, PublicKey publicKey) throws Exception {
Signature signature = Signature.getInstance("SHA256withRSA");
signature.initVerify(publicKey);
signature.update(data);
return signature.verify(sign);
}
Other important info:
java --version
: 1.8.0The text was updated successfully, but these errors were encountered: