Comments (6)
Or is it possible to store the generated key pair into the CryptoKeyPair object from the JS web crypto API [1]?
I am not sure, if that is possible.
Pascal
[1] https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey
from core.
In general I like to keep public and secret keys separate from one another. The public key can always be generated from the secret key if needed.
from core.
Ok. Do you maybe know, if it is possible to import the created key from the library into the CryptoKeyPair/CryptoKey to use the standardized methods for signatures? Or is it possible to do the same behavior as in java (below) with this library?
Signature sig = Signature.getInstance("SHA256withECDSA");
sig.initSign(privateKey);
for(byte[] bytes : message) {
sig.update(bytes);
}
return sig.sign();
The method sig.sign()
gives me an byte array, but with the
ECDH.ECPSP_DSA(sha, rng ,privateKey,message,CS, DS);
I get the signature in form of CS
and DS
. Is it possible to create a signature as it is in java (above)?
The message is defined as follows:
List<byte[]> message
Thank you in advance!
EDIT:
In general I want to sign a nonce and a uid with the private key and want to get a byte array back.
from core.
Have I only to convert the CS
(I think that is the r value) and DS
(I thin it is the s value) [1] to a DER format like this example [2]
3045022065A67F8FF9CB5EA8BE899E94CB338FE09E2E596BC047D936FC2B96DC013B5DFC022100BE123D3F143AF91E4551AAFAE49C9187F64E323F5660D6C6198A9446C3F818A1
DER encoding:
30 - Sequence
45 - 45 hex bytes (69 decimal)
02 - Integer
20 - 20 hex bytes (32 decimal)
65A67F8FF9CB5EA8BE899E94CB338FE09E2E596BC047D936FC2B96DC013B5DFC - 32 bytes integer signature (r)
02 - Integer
21 - 21 hex (33 decimal) bytes
00BE123D3F143AF91E4551AAFAE49C9187F64E323F5660D6C6198A9446C3F818A1 - 33 bytes integer signature (s)
or is there something more to do? I am not sure, but it seems to me that the Java Signature object gives a byte array back, which are in DER format.
[1] https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm#Signature_generation_algorithm
[2] https://crypto.stackexchange.com/questions/78248/difference-between-der-encoded-signatures-in-javascript-java-and-c
from core.
I am sure it is possible, it seems just a case of transforming the signature from one format to another, but I'm afraid I don't have the time to look into it right now...
from core.
Ok, thank you anyway!
from core.
Related Issues (20)
- JS library doesn't compile HOT 1
- BLS: bug in Rust implementation? HOT 3
- ECP::muln() bug? HOT 2
- Bug with BIG.mod in Java? HOT 2
- ECP2 multiply by FP in golang? HOT 15
- G2mul for ECP? (Golang) HOT 3
- golang: Signature Recover function using FP, ECP
- core/python could be structured more like a Python module HOT 2
- Javascript ecp2 toBytes functions gives not the same bytes as in the Java implementation HOT 5
- FP256BN Plus and math.MaxInt64
- feature request: addition of AES-CTR (and optionally, SIV-AES) HOT 2
- Reporting security issues HOT 2
- BLS12-381 Signature Aggregation HOT 3
- Is `ECP::mapit` a good random oracle? HOT 4
- secp256r1 HOT 2
- Support go modules HOT 3
- Pairing Example with JS
- select indepentent generator with node js HOT 1
- Attack against M-PIN HOT 4
- core/java: ECP compression HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from core.