import * as pkcs11 from "pkcs11js"; /** * Represents the list of attributes */ export interface ITemplate { [key: string]: any; /** * CKA_CLASS */ class?: number | null; /** * CKA_TOKEN */ token?: boolean | null; /** * CKA_PRIVATE */ private?: boolean | null; /** * CKA_LABEL */ label?: string | null; /** * CKA_APPLICATION */ application?: string | null; /** * CKA_VALUE */ value?: Buffer | null; /** * CKA_OBJECT_ID */ objectId?: Buffer | null; /** * CKA_CERTIFICATE_TYPE */ certType?: number; /** * CKA_ISSUER */ issuer?: Buffer | null; /** * CKA_SERIAL_NUMBER */ serial?: Buffer | null; /** * CKA_AC_ISSUER */ issuerAC?: Buffer | null; /** * CKA_OWNER */ owner?: Buffer | null; /** * CKA_ATTR_TYPES */ attrTypes?: Buffer | null; /** * CKA_TRUSTED */ trusted?: boolean | null; /** * CKA_CERTIFICATE_CATEGORY */ certCategory?: number | null; /** * CKA_JAVA_MIDP_SECURITY_DOMAIN */ javaDomain?: number | null; /** * CKA_URL */ url?: string | null; /** * CKA_HASH_OF_SUBJECT_PUBLIC_KEY */ ski?: Buffer | null; /** * CKA_HASH_OF_ISSUER_PUBLIC_KEY */ aki?: Buffer | null; /** * CKA_NAME_HASH_ALGORITHM */ digestName?: number | null; /** * CKA_CHECK_VALUE */ checkValue?: Buffer | null; /** * CKA_KEY_TYPE */ keyType?: number | null; /** * CKA_SUBJECT */ subject?: Buffer | null; /** * CKA_ID */ id?: Buffer | null; /** * CKA_SENSITIVE */ sensitive?: boolean | null; /** * CKA_ENCRYPT */ encrypt?: boolean | null; /** * CKA_DECRYPT */ decrypt?: boolean | null; /** * CKA_WRAP */ wrap?: boolean | null; /** * CKA_UNWRAP */ unwrap?: boolean | null; /** * CKA_SIGN */ sign?: boolean | null; /** * CKA_SIGN_RECOVER */ signRecover?: boolean | null; /** * CKA_VERIFY */ verify?: boolean | null; /** * CKA_VERIFY_RECOVER */ verifyRecover?: boolean | null; /** * CKA_DERIVE */ derive?: boolean | null; /** * CKA_START_DATE */ startDate?: Date | null; /** * CKA_END_DATE */ endDate?: Date | null; /** * CKA_MODULUS */ modulus?: Buffer | null; /** * CKA_MODULUS_BITS */ modulusBits?: number | null; /** * CKA_PUBLIC_EXPONENT */ publicExponent?: Buffer | null; /** * CKA_PRIVATE_EXPONENT */ privateExponent?: Buffer | null; /** * CKA_PRIME_1 */ prime1?: Buffer | null; /** * CKA_PRIME_2 */ prime2?: Buffer | null; /** * CKA_EXPONENT_1 */ exp1?: Buffer | null; /** * CKA_EXPONENT_2 */ exp2?: Buffer | null; /** * CKA_COEFFICIENT */ coefficient?: Buffer | null; /** * CKA_PRIME */ prime?: Buffer | null; /** * CKA_SUBPRIME */ subprime?: Buffer | null; /** * CKA_BASE */ base?: Buffer | null; /** * CKA_PRIME_BITS */ primeBits?: number | null; /** * CKA_SUBPRIME_BITS */ subprimeBits?: number | null; /** * CKA_VALUE_BITS */ valueBits?: number | null; /** * CKA_VALUE_LEN */ valueLen?: number | null; /** * CKA_EXTRACTABLE */ extractable?: boolean | null; /** * CKA_LOCAL */ local?: boolean | null; /** * CKA_NEVER_EXTRACTABLE */ neverExtractable?: boolean | null; /** * CKA_ALWAYS_SENSITIVE */ alwaysSensitive?: boolean | null; /** * CKA_KEY_GEN_MECHANISM */ keyGenMechanism?: number | null; /** * CKA_MODIFIABLE */ modifiable?: boolean | null; /** * CKA_COPYABLE */ copyable?: boolean | null; /** * CKA_ECDSA_PARAMS */ paramsECDSA?: Buffer | null; paramsEC?: Buffer | null; /** * CKA_EC_POINT */ pointEC?: Buffer | null; /** * CKA_SECONDARY_AUTH */ secondaryAuth?: boolean | null; /** * CKA_AUTH_PIN_FLAGS */ authPinFlags?: Buffer | null; /** * CKA_ALWAYS_AUTHENTICATE */ alwaysAuth?: boolean | null; /** * CKA_WRAP_WITH_TRUSTED */ wrapWithTrusted?: boolean | null; /** * CKA_WRAP_TEMPLATE */ wrapTemplate?: any | null; /** * CKA_UNWRAP_TEMPLATE */ unwrapTemplate?: any | null; /** * CKA_OTP_FORMAT */ otpFormat?: any | null; /** * CKA_OTP_LENGTH */ otpLength?: any | null; /** * CKA_OTP_TIME_INTERVAL */ otpTimeInterval?: any | null; /** * CKA_OTP_USER_FRIENDLY_MODE */ otpUserFriendlyMode?: any | null; /** * CKA_OTP_CHALLENGE_REQUIREMENT */ otpChallengeReq?: any | null; /** * CKA_OTP_TIME_REQUIREMENT */ otpTimeReq?: any | null; /** * CKA_OTP_COUNTER_REQUIREMENT */ otpCounterReq?: any | null; /** * CKA_OTP_PIN_REQUIREMENT */ otpPinReq?: any | null; /** * CKA_OTP_COUNTER */ otpCounter?: any | null; /** * CKA_OTP_TIME */ otpTime?: any | null; /** * CKA_OTP_USER_IDENTIFIER */ otpUserId?: any | null; /** * CKA_OTP_SERVICE_IDENTIFIER */ otpServiceId?: any | null; /** * CKA_OTP_SERVICE_LOGO */ otpServiceLogo?: any | null; /** * CKA_OTP_SERVICE_LOGO_TYPE */ otpServiceLogoType?: any | null; /** * CKA_HW_FEATURE_TYPE */ hwFeatureType?: any | null; /** * CKA_RESET_ON_INIT */ resetOnInit?: any | null; /** * CKA_HAS_RESET */ hasReset?: any | null; /** * CKA_PIXEL_X */ pixelX?: any | null; /** * CKA_PIXEL_Y */ pixelY?: any | null; /** * CKA_RESOLUTION */ resolution?: any | null; /** * CKA_CHAR_ROWS */ charRows?: any | null; /** * CKA_CHAR_COLUMNS */ charCols?: any | null; /** * CKA_COLOR */ color?: any | null; /** * CKA_BITS_PER_PIXEL */ bitsPerPixel?: any | null; /** * CKA_CHAR_SETS */ charSets?: any | null; /** * CKA_ENCODING_METHODS */ encMethod?: any | null; /** * CKA_MIME_TYPES */ mimeTypes?: any | null; /** * CKA_MECHANISM_TYPE */ mechanismType?: any | null; /** * CKA_REQUIRED_CMS_ATTRIBUTES */ requiredCmsAttrs?: any | null; /** * CKA_DEFAULT_CMS_ATTRIBUTES */ defaultCmsAttrs?: any | null; /** * CKA_SUPPORTED_CMS_ATTRIBUTES */ supportedCmsAttrs?: any | null; /** * CKA_ALLOWED_MECHANISMS */ allowedMechanisms?: any | null; } export type AttributeItemType = "number" | "boolean" | "string" | "buffer" | "date"; interface IAttributeItem { /** * Value of Attribute type (CKA_...) */ v: number; /** * Type of Attribute */ t: AttributeItemType; } /** * Gets attribute item by name * @param name Attribute name * @returns Attribute item * @throws {@link Error} if attribute name is not registered */ export declare function getAttribute(name: string): IAttributeItem; /** * Static class that allows to convert graphene template to pkcs11js template and back */ export declare class Template { /** * Converts Graphene Template to PKCS#11 Template * @param tmpl Graphene Template * @returns pkcs11js template */ static toPkcs11(tmpl: ITemplate | null): pkcs11.Template; /** * Converts PKCS#11 Template to Graphene Template * @param tmpl PKCS#11 Template * @returns Graphene template */ static fromPkcs11(tmpl: pkcs11.Template): ITemplate; } /** * Registers attribute items * @param name The name of attribute * @param value PKCS#11 number value of attribute * @param type The string name of type */ export declare function registerAttribute(name: string, value: number, type: AttributeItemType): void; export {};