@peculiar/asn1-asym-key
Version:
Provides ASN.1 schema definitions for the asymmetric key packages format specified in RFC5958. This format is used to encapsulate private and public keys, along with additional parameters and metadata, for a variety of asymmetric key algorithms.
65 lines (64 loc) • 2.56 kB
JavaScript
var AsymmetricKeyPackage_1;
import { __decorate } from "tslib";
import { Attributes } from "@peculiar/asn1-pkcs8";
import { AsnArray, AsnProp, AsnPropTypes, AsnType, AsnTypeTypes, BitString, OctetString, } from "@peculiar/asn1-schema";
import { AlgorithmIdentifier } from "@peculiar/asn1-x509";
export const id_ct_KP_aKeyPackage = "2.16.840.1.101.2.1.78.5";
export var Version;
(function (Version) {
Version[Version["v1"] = 0] = "v1";
Version[Version["v2"] = 1] = "v2";
})(Version || (Version = {}));
let PrivateKeyAlgorithmIdentifier = class PrivateKeyAlgorithmIdentifier extends AlgorithmIdentifier {
};
PrivateKeyAlgorithmIdentifier = __decorate([
AsnType({ type: AsnTypeTypes.Sequence })
], PrivateKeyAlgorithmIdentifier);
export { PrivateKeyAlgorithmIdentifier };
export class PrivateKey extends OctetString {
}
export class PublicKey extends BitString {
}
let OneAsymmetricKey = class OneAsymmetricKey {
constructor() {
this.version = Version.v1;
this.privateKeyAlgorithm = new AlgorithmIdentifier();
this.privateKey = new ArrayBuffer(0);
}
};
__decorate([
AsnProp({ type: AsnPropTypes.Integer })
], OneAsymmetricKey.prototype, "version", void 0);
__decorate([
AsnProp({ type: AlgorithmIdentifier })
], OneAsymmetricKey.prototype, "privateKeyAlgorithm", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.OctetString })
], OneAsymmetricKey.prototype, "privateKey", void 0);
__decorate([
AsnProp({ type: Attributes, context: 0, implicit: true, optional: true })
], OneAsymmetricKey.prototype, "attributes", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.BitString, context: 1, implicit: true, optional: true })
], OneAsymmetricKey.prototype, "publicKey", void 0);
OneAsymmetricKey = __decorate([
AsnType({ type: AsnTypeTypes.Sequence })
], OneAsymmetricKey);
export { OneAsymmetricKey };
let PrivateKeyInfo = class PrivateKeyInfo extends OneAsymmetricKey {
};
PrivateKeyInfo = __decorate([
AsnType({ type: AsnTypeTypes.Sequence })
], PrivateKeyInfo);
export { PrivateKeyInfo };
let AsymmetricKeyPackage = AsymmetricKeyPackage_1 = class AsymmetricKeyPackage extends AsnArray {
constructor(items) {
super(items);
Object.setPrototypeOf(this, AsymmetricKeyPackage_1.prototype);
}
};
AsymmetricKeyPackage = AsymmetricKeyPackage_1 = __decorate([
AsnType({ type: AsnTypeTypes.Sequence, itemType: OneAsymmetricKey })
], AsymmetricKeyPackage);
export { AsymmetricKeyPackage };
export { EncryptedPrivateKeyInfo, EncryptedData } from "@peculiar/asn1-pkcs8";