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,24 @@
import { __decorate } from "tslib";
import { AsnProp, AsnPropTypes } from "@peculiar/asn1-schema";
export class AttestationPackageInfo {
constructor(params = {}) {
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: AsnPropTypes.OctetString })
], AttestationPackageInfo.prototype, "packageName", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer })
], AttestationPackageInfo.prototype, "version", void 0);
export class AttestationApplicationId {
constructor(params = {}) {
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: AttestationPackageInfo, repeated: "set" })
], AttestationApplicationId.prototype, "packageInfos", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.OctetString, repeated: "set" })
], AttestationApplicationId.prototype, "signatureDigests", void 0);

View File

@@ -0,0 +1,3 @@
export * from "./key_description";
export * from "./nonstandard";
export * from "./attestation";

View File

@@ -0,0 +1,290 @@
var IntegerSet_1;
import { __decorate } from "tslib";
import { AsnProp, AsnPropTypes, AsnArray, AsnType, AsnTypeTypes, OctetString, } from "@peculiar/asn1-schema";
export const id_ce_keyDescription = "1.3.6.1.4.1.11129.2.1.17";
export var VerifiedBootState;
(function (VerifiedBootState) {
VerifiedBootState[VerifiedBootState["verified"] = 0] = "verified";
VerifiedBootState[VerifiedBootState["selfSigned"] = 1] = "selfSigned";
VerifiedBootState[VerifiedBootState["unverified"] = 2] = "unverified";
VerifiedBootState[VerifiedBootState["failed"] = 3] = "failed";
})(VerifiedBootState || (VerifiedBootState = {}));
export class RootOfTrust {
constructor(params = {}) {
this.verifiedBootKey = new OctetString();
this.deviceLocked = false;
this.verifiedBootState = VerifiedBootState.verified;
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: OctetString })
], RootOfTrust.prototype, "verifiedBootKey", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Boolean })
], RootOfTrust.prototype, "deviceLocked", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Enumerated })
], RootOfTrust.prototype, "verifiedBootState", void 0);
__decorate([
AsnProp({ type: OctetString, optional: true })
], RootOfTrust.prototype, "verifiedBootHash", void 0);
let IntegerSet = IntegerSet_1 = class IntegerSet extends AsnArray {
constructor(items) {
super(items);
Object.setPrototypeOf(this, IntegerSet_1.prototype);
}
};
IntegerSet = IntegerSet_1 = __decorate([
AsnType({ type: AsnTypeTypes.Set, itemType: AsnPropTypes.Integer })
], IntegerSet);
export { IntegerSet };
export class AuthorizationList {
constructor(params = {}) {
Object.assign(this, params);
}
}
__decorate([
AsnProp({ context: 1, type: IntegerSet, optional: true })
], AuthorizationList.prototype, "purpose", void 0);
__decorate([
AsnProp({ context: 2, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "algorithm", void 0);
__decorate([
AsnProp({ context: 3, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "keySize", void 0);
__decorate([
AsnProp({ context: 5, type: IntegerSet, optional: true })
], AuthorizationList.prototype, "digest", void 0);
__decorate([
AsnProp({ context: 6, type: IntegerSet, optional: true })
], AuthorizationList.prototype, "padding", void 0);
__decorate([
AsnProp({ context: 10, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "ecCurve", void 0);
__decorate([
AsnProp({ context: 200, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "rsaPublicExponent", void 0);
__decorate([
AsnProp({ context: 203, type: IntegerSet, optional: true })
], AuthorizationList.prototype, "mgfDigest", void 0);
__decorate([
AsnProp({ context: 303, type: AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "rollbackResistance", void 0);
__decorate([
AsnProp({ context: 305, type: AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "earlyBootOnly", void 0);
__decorate([
AsnProp({ context: 400, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "activeDateTime", void 0);
__decorate([
AsnProp({ context: 401, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "originationExpireDateTime", void 0);
__decorate([
AsnProp({ context: 402, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "usageExpireDateTime", void 0);
__decorate([
AsnProp({ context: 405, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "usageCountLimit", void 0);
__decorate([
AsnProp({ context: 503, type: AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "noAuthRequired", void 0);
__decorate([
AsnProp({ context: 504, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "userAuthType", void 0);
__decorate([
AsnProp({ context: 505, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "authTimeout", void 0);
__decorate([
AsnProp({ context: 506, type: AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "allowWhileOnBody", void 0);
__decorate([
AsnProp({ context: 507, type: AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "trustedUserPresenceRequired", void 0);
__decorate([
AsnProp({ context: 508, type: AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "trustedConfirmationRequired", void 0);
__decorate([
AsnProp({ context: 509, type: AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "unlockedDeviceRequired", void 0);
__decorate([
AsnProp({ context: 600, type: AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "allApplications", void 0);
__decorate([
AsnProp({ context: 601, type: OctetString, optional: true })
], AuthorizationList.prototype, "applicationId", void 0);
__decorate([
AsnProp({ context: 701, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "creationDateTime", void 0);
__decorate([
AsnProp({ context: 702, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "origin", void 0);
__decorate([
AsnProp({ context: 703, type: AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "rollbackResistant", void 0);
__decorate([
AsnProp({ context: 704, type: RootOfTrust, optional: true })
], AuthorizationList.prototype, "rootOfTrust", void 0);
__decorate([
AsnProp({ context: 705, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "osVersion", void 0);
__decorate([
AsnProp({ context: 706, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "osPatchLevel", void 0);
__decorate([
AsnProp({ context: 709, type: OctetString, optional: true })
], AuthorizationList.prototype, "attestationApplicationId", void 0);
__decorate([
AsnProp({ context: 710, type: OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdBrand", void 0);
__decorate([
AsnProp({ context: 711, type: OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdDevice", void 0);
__decorate([
AsnProp({ context: 712, type: OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdProduct", void 0);
__decorate([
AsnProp({ context: 713, type: OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdSerial", void 0);
__decorate([
AsnProp({ context: 714, type: OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdImei", void 0);
__decorate([
AsnProp({ context: 715, type: OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdMeid", void 0);
__decorate([
AsnProp({ context: 716, type: OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdManufacturer", void 0);
__decorate([
AsnProp({ context: 717, type: OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdModel", void 0);
__decorate([
AsnProp({ context: 718, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "vendorPatchLevel", void 0);
__decorate([
AsnProp({ context: 719, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "bootPatchLevel", void 0);
__decorate([
AsnProp({ context: 720, type: AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "deviceUniqueAttestation", void 0);
__decorate([
AsnProp({ context: 723, type: OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdSecondImei", void 0);
__decorate([
AsnProp({ context: 724, type: OctetString, optional: true })
], AuthorizationList.prototype, "moduleHash", void 0);
export var SecurityLevel;
(function (SecurityLevel) {
SecurityLevel[SecurityLevel["software"] = 0] = "software";
SecurityLevel[SecurityLevel["trustedEnvironment"] = 1] = "trustedEnvironment";
SecurityLevel[SecurityLevel["strongBox"] = 2] = "strongBox";
})(SecurityLevel || (SecurityLevel = {}));
export var Version;
(function (Version) {
Version[Version["KM2"] = 1] = "KM2";
Version[Version["KM3"] = 2] = "KM3";
Version[Version["KM4"] = 3] = "KM4";
Version[Version["KM4_1"] = 4] = "KM4_1";
Version[Version["keyMint1"] = 100] = "keyMint1";
Version[Version["keyMint2"] = 200] = "keyMint2";
Version[Version["keyMint3"] = 300] = "keyMint3";
Version[Version["keyMint4"] = 400] = "keyMint4";
})(Version || (Version = {}));
export class KeyDescription {
constructor(params = {}) {
this.attestationVersion = Version.KM4;
this.attestationSecurityLevel = SecurityLevel.software;
this.keymasterVersion = 0;
this.keymasterSecurityLevel = SecurityLevel.software;
this.attestationChallenge = new OctetString();
this.uniqueId = new OctetString();
this.softwareEnforced = new AuthorizationList();
this.teeEnforced = new AuthorizationList();
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: AsnPropTypes.Integer })
], KeyDescription.prototype, "attestationVersion", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Enumerated })
], KeyDescription.prototype, "attestationSecurityLevel", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer })
], KeyDescription.prototype, "keymasterVersion", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Enumerated })
], KeyDescription.prototype, "keymasterSecurityLevel", void 0);
__decorate([
AsnProp({ type: OctetString })
], KeyDescription.prototype, "attestationChallenge", void 0);
__decorate([
AsnProp({ type: OctetString })
], KeyDescription.prototype, "uniqueId", void 0);
__decorate([
AsnProp({ type: AuthorizationList })
], KeyDescription.prototype, "softwareEnforced", void 0);
__decorate([
AsnProp({ type: AuthorizationList })
], KeyDescription.prototype, "teeEnforced", void 0);
export class KeyMintKeyDescription {
constructor(params = {}) {
this.attestationVersion = Version.keyMint4;
this.attestationSecurityLevel = SecurityLevel.software;
this.keyMintVersion = 0;
this.keyMintSecurityLevel = SecurityLevel.software;
this.attestationChallenge = new OctetString();
this.uniqueId = new OctetString();
this.softwareEnforced = new AuthorizationList();
this.hardwareEnforced = new AuthorizationList();
Object.assign(this, params);
}
toLegacyKeyDescription() {
return new KeyDescription({
attestationVersion: this.attestationVersion,
attestationSecurityLevel: this.attestationSecurityLevel,
keymasterVersion: this.keyMintVersion,
keymasterSecurityLevel: this.keyMintSecurityLevel,
attestationChallenge: this.attestationChallenge,
uniqueId: this.uniqueId,
softwareEnforced: this.softwareEnforced,
teeEnforced: this.hardwareEnforced,
});
}
static fromLegacyKeyDescription(keyDesc) {
return new KeyMintKeyDescription({
attestationVersion: keyDesc.attestationVersion,
attestationSecurityLevel: keyDesc.attestationSecurityLevel,
keyMintVersion: keyDesc.keymasterVersion,
keyMintSecurityLevel: keyDesc.keymasterSecurityLevel,
attestationChallenge: keyDesc.attestationChallenge,
uniqueId: keyDesc.uniqueId,
softwareEnforced: keyDesc.softwareEnforced,
hardwareEnforced: keyDesc.teeEnforced,
});
}
}
__decorate([
AsnProp({ type: AsnPropTypes.Integer })
], KeyMintKeyDescription.prototype, "attestationVersion", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Enumerated })
], KeyMintKeyDescription.prototype, "attestationSecurityLevel", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer })
], KeyMintKeyDescription.prototype, "keyMintVersion", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Enumerated })
], KeyMintKeyDescription.prototype, "keyMintSecurityLevel", void 0);
__decorate([
AsnProp({ type: OctetString })
], KeyMintKeyDescription.prototype, "attestationChallenge", void 0);
__decorate([
AsnProp({ type: OctetString })
], KeyMintKeyDescription.prototype, "uniqueId", void 0);
__decorate([
AsnProp({ type: AuthorizationList })
], KeyMintKeyDescription.prototype, "softwareEnforced", void 0);
__decorate([
AsnProp({ type: AuthorizationList })
], KeyMintKeyDescription.prototype, "hardwareEnforced", void 0);

View File

@@ -0,0 +1,100 @@
var NonStandardAuthorizationList_1;
import { __decorate } from "tslib";
import { AsnProp, AsnPropTypes, AsnArray, AsnType, AsnTypeTypes, OctetString, } from "@peculiar/asn1-schema";
import { AuthorizationList, SecurityLevel, Version } from "./key_description";
let NonStandardAuthorization = class NonStandardAuthorization extends AuthorizationList {
};
NonStandardAuthorization = __decorate([
AsnType({ type: AsnTypeTypes.Choice })
], NonStandardAuthorization);
export { NonStandardAuthorization };
let NonStandardAuthorizationList = NonStandardAuthorizationList_1 = class NonStandardAuthorizationList extends AsnArray {
constructor(items) {
super(items);
Object.setPrototypeOf(this, NonStandardAuthorizationList_1.prototype);
}
findProperty(key) {
const prop = this.find((o) => key in o);
if (prop) {
return prop[key];
}
return undefined;
}
};
NonStandardAuthorizationList = NonStandardAuthorizationList_1 = __decorate([
AsnType({ type: AsnTypeTypes.Sequence, itemType: NonStandardAuthorization })
], NonStandardAuthorizationList);
export { NonStandardAuthorizationList };
export class NonStandardKeyDescription {
get keyMintVersion() {
return this.keymasterVersion;
}
set keyMintVersion(value) {
this.keymasterVersion = value;
}
get keyMintSecurityLevel() {
return this.keymasterSecurityLevel;
}
set keyMintSecurityLevel(value) {
this.keymasterSecurityLevel = value;
}
get hardwareEnforced() {
return this.teeEnforced;
}
set hardwareEnforced(value) {
this.teeEnforced = value;
}
constructor(params = {}) {
this.attestationVersion = Version.KM4;
this.attestationSecurityLevel = SecurityLevel.software;
this.keymasterVersion = 0;
this.keymasterSecurityLevel = SecurityLevel.software;
this.attestationChallenge = new OctetString();
this.uniqueId = new OctetString();
this.softwareEnforced = new NonStandardAuthorizationList();
this.teeEnforced = new NonStandardAuthorizationList();
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: AsnPropTypes.Integer })
], NonStandardKeyDescription.prototype, "attestationVersion", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Enumerated })
], NonStandardKeyDescription.prototype, "attestationSecurityLevel", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer })
], NonStandardKeyDescription.prototype, "keymasterVersion", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Enumerated })
], NonStandardKeyDescription.prototype, "keymasterSecurityLevel", void 0);
__decorate([
AsnProp({ type: OctetString })
], NonStandardKeyDescription.prototype, "attestationChallenge", void 0);
__decorate([
AsnProp({ type: OctetString })
], NonStandardKeyDescription.prototype, "uniqueId", void 0);
__decorate([
AsnProp({ type: NonStandardAuthorizationList })
], NonStandardKeyDescription.prototype, "softwareEnforced", void 0);
__decorate([
AsnProp({ type: NonStandardAuthorizationList })
], NonStandardKeyDescription.prototype, "teeEnforced", void 0);
let NonStandardKeyMintKeyDescription = class NonStandardKeyMintKeyDescription extends NonStandardKeyDescription {
constructor(params = {}) {
if ("keymasterVersion" in params && !("keyMintVersion" in params)) {
params.keyMintVersion = params.keymasterVersion;
}
if ("keymasterSecurityLevel" in params && !("keyMintSecurityLevel" in params)) {
params.keyMintSecurityLevel = params.keymasterSecurityLevel;
}
if ("teeEnforced" in params && !("hardwareEnforced" in params)) {
params.hardwareEnforced = params.teeEnforced;
}
super(params);
}
};
NonStandardKeyMintKeyDescription = __decorate([
AsnType({ type: AsnTypeTypes.Sequence })
], NonStandardKeyMintKeyDescription);
export { NonStandardKeyMintKeyDescription };