Miroshin Stepan

Results 356 comments of Miroshin Stepan

I'll take a look at this problem and try to fix it in PKIjs. But ideally, we need to update ASN1js API which requires update PKIjs too (it's a lot...

@dhensby Please take a look at this example ```ts import { X509CertificateGenerator, Name as X509Name } from "@peculiar/x509"; import { Certificate, GeneralName, Name } from "@peculiar/asn1-x509"; import { sha1, sha256WithRSAEncryption...

`@peculiar/x509` does it. It also allows registering known extensions in runtime. By default, it implements these extensions ![image](https://user-images.githubusercontent.com/7333669/116255861-5099ba00-a77b-11eb-8433-7a3c2dc6e592.png)

Here is one more example of `@peculiar/x509` usage https://codesandbox.io/s/generate-cert-fjwfh?file=/src/main.js As you can see each extension has got parsed values ![image](https://user-images.githubusercontent.com/7333669/116256399-d3bb1000-a77b-11eb-8bea-eabdab5f5f19.png)

I don't like the idea of keeping bundled (compiled) files in repo. unpkg cdn-provider allows to use this module without minification ```js import * as asn1js from "https://unpkg.com/asn1js?module"; ```

I've published `[email protected]`. Please try it. **HTML** ```html Document import * as asn1js from "https://unpkg.com/asn1js?module"; const asn = new asn1js.Utf8String({ value: "Hello world", }); console.log(asn.toString()); // ascii console.log(asn.toString("hex")); ``` **Console**...

You can find a similar CMS [here](https://github.com/micromdm/scep/blob/master/scep/testdata/PKCSReq.der) ### ASN1 structure ![image](https://user-images.githubusercontent.com/7333669/63641412-863cf480-c6b6-11e9-8e7b-d9e451fc99a0.png)

### RFC3560 ``` RSAES-OAEP-params ::= SEQUENCE { hashFunc [0] AlgorithmIdentifier DEFAULT sha1Identifier, maskGenFunc [1] AlgorithmIdentifier DEFAULT mgf1SHA1Identifier, pSourceFunc [2] AlgorithmIdentifier DEFAULT pSpecifiedEmptyIdentifier } ``` https://tools.ietf.org/html/rfc3560#section-3

I found a way to do decrypt a message using NodeJs Crypto API `rsaEncryption(1.2.840.113549.1.1.1)` means `RSA_PKCS1_PADDING`, not `RSA-OAEP` ```js const crypto = require("crypto"); const encRaw = Buffer.from("76e5ea6e1df52471454f790923f60e2baa7adf5017fe0a36c0af3e32f6390d570e1d592375ba6035fdf4ffa70764b797ab54d0ab1efe89cf31d7fc98240a4d08c2476b7eb4c2d92355b8bf60e3897c3fcbfe09f20c7b159d9a9c4a6b2ce5021dd313e492afa762c24930f97f03a429f7b2b1e1d6088651d60e323835807c6fefe7952f74e5da29e8e327ea46e69a0a6684272f022bf18ec602ffcd10a62666b35a51ec7c7d101096f663ddfa0924a86bdbcde0433b4f71dc42bfd9facf329558026f8667f1a71c3365e09843a12339d8aaf31987b0d800e53fd0835e990096cb145e278153faf1188cd5713c6fcd289cb77d80515e1d200139b8ccac4d3bcebc", "hex"); const dec...

I'm going to add `RSAES-PKCS1-v1_5` algorithm to PeculiarVentures WebCrypto libraries. Looks like this mechanism is still used