/**
 * DevExtreme (esm/__internal/core/license/pkcs1.js)
 * Version: 23.2.6 (build 24140-0112)
 * Build date: Sun May 19 2024
 *
 * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
import {
    concatBytes,
    hexToBytes
} from "./byte_utils";
import {
    PUBLIC_KEY
} from "./key";
var ASN1_SHA1 = "3021300906052b0e03021a05000414";
export function pad(hash) {
    var dataLength = (8 * PUBLIC_KEY.n.length + 6) / 8;
    var data = concatBytes(hexToBytes(ASN1_SHA1), hash);
    if (data.length + 10 > dataLength) {
        throw Error("Key is too short for SHA1 signing algorithm")
    }
    var padding = new Uint8Array(dataLength - data.length);
    padding.fill(255, 0, padding.length - 1);
    padding[0] = 0;
    padding[1] = 1;
    padding[padding.length - 1] = 0;
    return concatBytes(padding, data)
}
