Function sigASN1toRS

  • convert ECDSA signature value from ASN.1 encoded to RS concatinated

    Parameters

    • hASN: string

      hexadecimal string of ECDSA ASN.1 signature value

    • Optional alg: string

    Returns string

    R and S concatinated ECDSA signature value

    See

    sigRStoASN1

    Description

    ECDSA signature value has two types of encoding:

    • R and S value concatinated encoding used in W3C Web Crypto API or JSON Web Signature.
    • ASN.1 SEQUENCE of INTEGER R and S value used in OpenSSL or Java

    This function converts a ECDSA signature encoding from ASN.1 to concatinated. This function supports ECDSA signatures by P-256, P-384 and P-521.

    Example

    sigRStoASN1(
    "3044
    0220
    69c3e2489cc23044f91dce1e5efab7a47f8c2a545cdce9b58e408c6a2aabd060
    0220
    76ba3d70771c00451adcf608d93f20cc79ccaf872f42028aa05ff57b14e5959f")
    ->
    "69c3e2489cc23044f91dce1e5efab7a47f8c2a545cdce9b58e408c6a2aabd060
    76ba3d70771c00451adcf608d93f20cc79ccaf872f42028aa05ff57b14e5959f"
    // new lines and specs added to understand their structues