import { StronglyConnectedGraph } from '../utils/graph-utils'; import { DataOwner, DataOwnerOrStub, IccDataOwnerXApi } from '../icc-data-owner-x-api'; import { RSAUtils, ShaVersion } from './RSA'; import { ExtendedApisUtils } from './ExtendedApisUtils'; import { CryptoPrimitives } from './CryptoPrimitives'; import { IccPatientApi } from '../../icc-api'; import { DataOwnerWithType } from '../../icc-api/model/DataOwnerWithType'; /** * Get the public keys of a data owner which should be used for RSA-OAEP with sha256. * @param dataOwner */ export declare function hexPublicKeysWithSha256Of(dataOwner: DataOwner): Set; /** * Get the public keys of a data owner which should be used for RSA-OAEP with sha1. * @param dataOwner */ export declare function hexPublicKeysWithSha1Of(dataOwner: DataOwner): Set; /** * @internal this function is meant only for internal use and may be changed without notice. * Get the transfer key graph for a data owner. Node names are the public key fingerprints of the data owner's keys, and an edge represents a key * which can be retrieved from another key using the transfer keys. * @param dataOwner a data owner. * @return a graph representing the possible key recovery paths using transfer keys for hte provided data owner. */ export declare function transferKeysFpGraphOf(dataOwner: DataOwner): StronglyConnectedGraph; /** * @internal this function is meant only for internal use and may be changed without notice. * Get a map for converting public keys fingerprint to full public keys for the provided data owner. * @param dataOwner a data owner. * @param shaVersion gets only the keys that are generated with this SHA version (default: 'sha-1'). * @return a map to convert fingerprints of the data owner into full public keys. */ export declare function fingerprintToPublicKeysMapOf(dataOwner: DataOwner, shaVersion: ShaVersion): { [fp: string]: string; }; /** * @internal this function is meant only for internal use and may be changed without notice. * Load many public keys in spki format. * @param rsa the rsa service * @param publicKeysSpkiHex public keys in spki format, hex encoded. * @param shaVersion the version of the Sha algorithm used in the keys generations. () * @return public keys as crypto keys by their fingerprint. */ export declare function loadPublicKeys(rsa: RSAUtils, publicKeysSpkiHex: string[], shaVersion: ShaVersion): Promise<{ [publicKeyFingerprint: string]: CryptoKey; }>; /** * @internal This method is intended only for internal use and may be changed without notice. * Creates a delegation for the current data owner if the data owner is an encrypted entity and there is no delegation to himself. * @return the updated self. */ export declare function ensureDelegationForSelf(dataOwnerApi: IccDataOwnerXApi, xapi: ExtendedApisUtils, patientApi: IccPatientApi, cryptoPrimitives: CryptoPrimitives): Promise; /** * Search a public key in the data owner and returns the corresponding SHA version used to generate it or undefined if not found. * @param dataOwner the data owner. * @param publicKey the public key. * @return 'sha-1', 'sha-256', undefined */ export declare function getShaVersionForKey(dataOwner: DataOwnerOrStub, publicKey: string): ShaVersion | undefined; /** * @internal this function is meant only for internal use and may be changed without notice. * Calculates the fingerprint from the hexadecimal representation of a SPKI key. The fingerprint is calculated as the last 16 bytes (32 characters) * of the SPKI key. * @param key the hexadecimal representation of the SPKI key. * @return the fingerprint. */ export declare function fingerprintV1(key: string): string; /** * @internal this function is meant only for internal use and may be changed without notice. * Calculates the fingerprint from the hexadecimal representation of a SPKI key. The fingerprint is calculated as the last 16 bytes (32 characters) from which the * last 5 (10 characters) are removed because they are a constant of the SPKI format. * @param key the hexadecimal representation of the SPKI key. * @return the fingerprint. */ export declare function fingerprintV2(key: string): string; /** * @internal this function is meant only for internal use and may be changed without notice. * Converts the fingerprint of a key from a V1 format to a V2 format. * @param fp the fingerprint of the key in the V1 format. * @return the fingerprint of the key in the v2 format. */ export declare function fingerprintV1toV2(fp: string): string; /** * @internal this function is meant only for internal use and may be changed without notice. * @param fp the fingerprint. * @return true if the fingerprint is in V1 format, false otherwise. */ export declare function fingerprintIsV1(fp: string): boolean; /** * @internal this function is meant only for internal use and may be changed without notice. * @param fp the fingerprint. * @return true if the fingerprint is in V2 format, false otherwise. */ export declare function fingerprintIsV2(fp: string): boolean; /** * @internal this function is meant only for internal use and may be changed without notice. * @param fp the fingerprint v2. * @return the fingerprint v1 using the standard tail. */ export declare function fingerprintV2ToStandardV1(fp: string): string; /** * @internal this function is meant only for internal use and may be changed without notice. * @param publicKeyOrFpv1 a public key in spki format or a public key fp v1 * @throws if the input does not terminate with 0203010001 */ export declare function checkStandardPublicKeyTail(publicKeyOrFpv1: string): void;