feat: 초기 프로젝트 설정 및 룰.md 파일 추가

This commit is contained in:
2025-07-28 09:53:31 +09:00
commit 09a4d38512
8165 changed files with 1021855 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
import { AsnConvert, AsnOctetStringConverter } from "@peculiar/asn1-schema";
import { AlgorithmIdentifier } from "@peculiar/asn1-x509";
import * as oid from "./object_identifiers";
function create(algorithm) {
return new AlgorithmIdentifier({ algorithm, parameters: null });
}
export const md2 = create(oid.id_md2);
export const md4 = create(oid.id_md5);
export const sha1 = create(oid.id_sha1);
export const sha224 = create(oid.id_sha224);
export const sha256 = create(oid.id_sha256);
export const sha384 = create(oid.id_sha384);
export const sha512 = create(oid.id_sha512);
export const sha512_224 = create(oid.id_sha512_224);
export const sha512_256 = create(oid.id_sha512_256);
export const mgf1SHA1 = new AlgorithmIdentifier({
algorithm: oid.id_mgf1,
parameters: AsnConvert.serialize(sha1),
});
export const pSpecifiedEmpty = new AlgorithmIdentifier({
algorithm: oid.id_pSpecified,
parameters: AsnConvert.serialize(AsnOctetStringConverter.toASN(new Uint8Array([
0xda, 0x39, 0xa3, 0xee, 0x5e, 0x6b, 0x4b, 0x0d, 0x32, 0x55, 0xbf, 0xef, 0x95, 0x60, 0x18,
0x90, 0xaf, 0xd8, 0x07, 0x09,
]).buffer)),
});
export const rsaEncryption = create(oid.id_rsaEncryption);
export const md2WithRSAEncryption = create(oid.id_md2WithRSAEncryption);
export const md5WithRSAEncryption = create(oid.id_md5WithRSAEncryption);
export const sha1WithRSAEncryption = create(oid.id_sha1WithRSAEncryption);
export const sha224WithRSAEncryption = create(oid.id_sha512_224WithRSAEncryption);
export const sha256WithRSAEncryption = create(oid.id_sha512_256WithRSAEncryption);
export const sha384WithRSAEncryption = create(oid.id_sha384WithRSAEncryption);
export const sha512WithRSAEncryption = create(oid.id_sha512WithRSAEncryption);
export const sha512_224WithRSAEncryption = create(oid.id_sha512_224WithRSAEncryption);
export const sha512_256WithRSAEncryption = create(oid.id_sha512_256WithRSAEncryption);

View File

@@ -0,0 +1,6 @@
export * from "./parameters";
export * from "./algorithms";
export * from "./object_identifiers";
export * from "./other_prime_info";
export * from "./rsa_private_key";
export * from "./rsa_public_key";

View File

@@ -0,0 +1,25 @@
export const id_pkcs_1 = "1.2.840.113549.1.1";
export const id_rsaEncryption = `${id_pkcs_1}.1`;
export const id_RSAES_OAEP = `${id_pkcs_1}.7`;
export const id_pSpecified = `${id_pkcs_1}.9`;
export const id_RSASSA_PSS = `${id_pkcs_1}.10`;
export const id_md2WithRSAEncryption = `${id_pkcs_1}.2`;
export const id_md5WithRSAEncryption = `${id_pkcs_1}.4`;
export const id_sha1WithRSAEncryption = `${id_pkcs_1}.5`;
export const id_sha224WithRSAEncryption = `${id_pkcs_1}.14`;
export const id_ssha224WithRSAEncryption = id_sha224WithRSAEncryption;
export const id_sha256WithRSAEncryption = `${id_pkcs_1}.11`;
export const id_sha384WithRSAEncryption = `${id_pkcs_1}.12`;
export const id_sha512WithRSAEncryption = `${id_pkcs_1}.13`;
export const id_sha512_224WithRSAEncryption = `${id_pkcs_1}.15`;
export const id_sha512_256WithRSAEncryption = `${id_pkcs_1}.16`;
export const id_sha1 = "1.3.14.3.2.26";
export const id_sha224 = "2.16.840.1.101.3.4.2.4";
export const id_sha256 = "2.16.840.1.101.3.4.2.1";
export const id_sha384 = "2.16.840.1.101.3.4.2.2";
export const id_sha512 = "2.16.840.1.101.3.4.2.3";
export const id_sha512_224 = "2.16.840.1.101.3.4.2.5";
export const id_sha512_256 = "2.16.840.1.101.3.4.2.6";
export const id_md2 = "1.2.840.113549.2.2";
export const id_md5 = "1.2.840.113549.2.5";
export const id_mgf1 = `${id_pkcs_1}.8`;

View File

@@ -0,0 +1,30 @@
var OtherPrimeInfos_1;
import { __decorate } from "tslib";
import { AsnProp, AsnPropTypes, AsnIntegerArrayBufferConverter, AsnArray, AsnType, AsnTypeTypes, } from "@peculiar/asn1-schema";
export class OtherPrimeInfo {
constructor(params = {}) {
this.prime = new ArrayBuffer(0);
this.exponent = new ArrayBuffer(0);
this.coefficient = new ArrayBuffer(0);
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], OtherPrimeInfo.prototype, "prime", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], OtherPrimeInfo.prototype, "exponent", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], OtherPrimeInfo.prototype, "coefficient", void 0);
let OtherPrimeInfos = OtherPrimeInfos_1 = class OtherPrimeInfos extends AsnArray {
constructor(items) {
super(items);
Object.setPrototypeOf(this, OtherPrimeInfos_1.prototype);
}
};
OtherPrimeInfos = OtherPrimeInfos_1 = __decorate([
AsnType({ type: AsnTypeTypes.Sequence, itemType: OtherPrimeInfo })
], OtherPrimeInfos);
export { OtherPrimeInfos };

View File

@@ -0,0 +1,3 @@
export * from "./rsaes_oaep";
export * from "./rsassa_pss";
export * from "./rsassa_pkcs1_v1_5";

View File

@@ -0,0 +1,29 @@
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";
import { sha1, mgf1SHA1, pSpecifiedEmpty } from "../algorithms";
export class RsaEsOaepParams {
constructor(params = {}) {
this.hashAlgorithm = new AlgorithmIdentifier(sha1);
this.maskGenAlgorithm = new AlgorithmIdentifier({
algorithm: id_mgf1,
parameters: AsnConvert.serialize(sha1),
});
this.pSourceAlgorithm = new AlgorithmIdentifier(pSpecifiedEmpty);
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()),
});

View File

@@ -0,0 +1,16 @@
import { __decorate } from "tslib";
import { AlgorithmIdentifier } from "@peculiar/asn1-x509";
import { AsnProp, OctetString } from "@peculiar/asn1-schema";
export class DigestInfo {
constructor(params = {}) {
this.digestAlgorithm = new AlgorithmIdentifier();
this.digest = new OctetString();
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: AlgorithmIdentifier })
], DigestInfo.prototype, "digestAlgorithm", void 0);
__decorate([
AsnProp({ type: OctetString })
], DigestInfo.prototype, "digest", void 0);

View File

@@ -0,0 +1,33 @@
import { __decorate } from "tslib";
import { AsnProp, AsnConvert, AsnPropTypes } from "@peculiar/asn1-schema";
import { AlgorithmIdentifier } from "@peculiar/asn1-x509";
import { id_mgf1, id_RSASSA_PSS } from "../object_identifiers";
import { sha1, mgf1SHA1 } from "../algorithms";
export class RsaSaPssParams {
constructor(params = {}) {
this.hashAlgorithm = new AlgorithmIdentifier(sha1);
this.maskGenAlgorithm = new AlgorithmIdentifier({
algorithm: id_mgf1,
parameters: AsnConvert.serialize(sha1),
});
this.saltLength = 20;
this.trailerField = 1;
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: AlgorithmIdentifier, context: 0, defaultValue: sha1 })
], RsaSaPssParams.prototype, "hashAlgorithm", void 0);
__decorate([
AsnProp({ type: AlgorithmIdentifier, context: 1, defaultValue: mgf1SHA1 })
], RsaSaPssParams.prototype, "maskGenAlgorithm", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, context: 2, defaultValue: 20 })
], RsaSaPssParams.prototype, "saltLength", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, context: 3, defaultValue: 1 })
], RsaSaPssParams.prototype, "trailerField", void 0);
export const RSASSA_PSS = new AlgorithmIdentifier({
algorithm: id_RSASSA_PSS,
parameters: AsnConvert.serialize(new RsaSaPssParams()),
});

View File

@@ -0,0 +1,47 @@
import { __decorate } from "tslib";
import { AsnProp, AsnPropTypes, AsnIntegerArrayBufferConverter } from "@peculiar/asn1-schema";
import { OtherPrimeInfos } from "./other_prime_info";
export class RSAPrivateKey {
constructor(params = {}) {
this.version = 0;
this.modulus = new ArrayBuffer(0);
this.publicExponent = new ArrayBuffer(0);
this.privateExponent = new ArrayBuffer(0);
this.prime1 = new ArrayBuffer(0);
this.prime2 = new ArrayBuffer(0);
this.exponent1 = new ArrayBuffer(0);
this.exponent2 = new ArrayBuffer(0);
this.coefficient = new ArrayBuffer(0);
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: AsnPropTypes.Integer })
], RSAPrivateKey.prototype, "version", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], RSAPrivateKey.prototype, "modulus", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], RSAPrivateKey.prototype, "publicExponent", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], RSAPrivateKey.prototype, "privateExponent", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], RSAPrivateKey.prototype, "prime1", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], RSAPrivateKey.prototype, "prime2", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], RSAPrivateKey.prototype, "exponent1", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], RSAPrivateKey.prototype, "exponent2", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], RSAPrivateKey.prototype, "coefficient", void 0);
__decorate([
AsnProp({ type: OtherPrimeInfos, optional: true })
], RSAPrivateKey.prototype, "otherPrimeInfos", void 0);

View File

@@ -0,0 +1,15 @@
import { __decorate } from "tslib";
import { AsnProp, AsnPropTypes, AsnIntegerArrayBufferConverter } from "@peculiar/asn1-schema";
export class RSAPublicKey {
constructor(params = {}) {
this.modulus = new ArrayBuffer(0);
this.publicExponent = new ArrayBuffer(0);
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], RSAPublicKey.prototype, "modulus", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], RSAPublicKey.prototype, "publicExponent", void 0);