Comments (3)
I found a solution which is working for me.
In nodejs crypto I have to generate a "rsa-pss" key of type "pkcs8".
const crypto = require("crypto");
var { publicKey, privateKey } = crypto.generateKeyPairSync(
'rsa-pss', {
modulusLength: 4096,
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
}
});
console.log(privateKey.toString());
While digging the issue I found that there are several sub versions of pkcs1 and pointycastle is currently only supporting up to v2.0 and it seems that the newer versions v2.1 and/or v2.2 have breaking changes which prevent the import (https://github.com/PointyCastle/pointycastle/blob/master/tutorials/rsa.md#standards-supported).
That is a bit of wild guess, since I have not debugged the ASN1 parsing in detail.
from crypton.
Let me take a look
from crypton.
I have the same issue.
It seems to only appear when using an "external" generated key.
When I inject a key which got generated by crypton in my process it is working fine.
In my case the keys are generated using NodeJs crypto library.
See the following code as example to reproduce key generation:
const crypto = require("crypto");
var { publicKey, privateKey } = crypto.generateKeyPairSync(
'rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'pkcs1',
format: 'pem'
},
privateKeyEncoding: {
type: 'pkcs1',
format: 'pem',
}
});
console.log(privateKey);
I try to import the private key using "RSAPrivateKey.fromPEM", but it is the same error if I strip down the key to be usable with the "fromString" function.
from crypton.
Related Issues (20)
- FormatException: Bad UTF-8 encoding HOT 5
- Long String Error HOT 1
- Unsupported block type for private key: 82 HOT 3
- Use crypton with NodeJs HOT 4
- How can I Encrypt with RSA in flutter and Decrypt in NodeJs ? HOT 2
- Signing and Verifying Algorithm HOT 5
- Can we generate RSA public key from PEM? HOT 4
- Null safety release HOT 4
- Add more curves to EC
- SHA-384/PSS Signature generation and verification HOT 3
- Building for web fails with javascript compilation errors HOT 3
- Examples in Documentation need updating to show new functions HOT 1
- Leading or trailing whitespaces cause fromPEM to fail
- Is this package support key from XML? HOT 1
- Make RSAKeypair.fromRandom() async? HOT 1
- Support to load a pkcs12 certificate file HOT 1
- Getting warnings on VM startup after running a dart pub upgrade HOT 3
- Update Readme to point to pointycastle package HOT 1
- Verification of the digital signature using EC key failed HOT 1
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 crypton.