@peculiar/asn1-rsa
Version:
ASN.1 schema for RSA keys and algorithms defined in RFC 8017.
36 lines (35 loc) • 1.29 kB
JavaScript
import { __decorate } from "tslib";
import { AsnProp, AsnConvert } from "@peculiar/asn1-schema";
import { AlgorithmIdentifier } from "@peculiar/asn1-x509";
import { id_mgf1, id_RSAES_OAEP } from "../object_identifiers.js";
import { sha1, mgf1SHA1, pSpecifiedEmpty, } from "../algorithms.js";
export class RsaEsOaepParams {
hashAlgorithm = new AlgorithmIdentifier(sha1);
maskGenAlgorithm = new AlgorithmIdentifier({
algorithm: id_mgf1,
parameters: AsnConvert.serialize(sha1),
});
pSourceAlgorithm = new AlgorithmIdentifier(pSpecifiedEmpty);
constructor(params = {}) {
Object.assign(this, params);
}
}
__decorate([
AsnProp({
type: AlgorithmIdentifier, context: 0, defaultValue: sha1,
})
], RsaEsOaepParams.prototype, "hashAlgorithm", void 0);
__decorate([
AsnProp({
type: AlgorithmIdentifier, context: 1, defaultValue: mgf1SHA1,
})
], RsaEsOaepParams.prototype, "maskGenAlgorithm", void 0);
__decorate([
AsnProp({
type: AlgorithmIdentifier, context: 2, defaultValue: pSpecifiedEmpty,
})
], RsaEsOaepParams.prototype, "pSourceAlgorithm", void 0);
export const RSAES_OAEP = new AlgorithmIdentifier({
algorithm: id_RSAES_OAEP,
parameters: AsnConvert.serialize(new RsaEsOaepParams()),
});