There is .pfx file on azure keyvault, I try to convert it into a byte array(Convert.FromBase64String), I am getting format exception

Rupesh Surve 0 Reputation points
2024-04-23T07:47:43.3066667+00:00

There is .pfx file on azure key vault, I try to convert it into a byte array(Convert.FromBase64String), I am getting below format exception

PFX file containt Primary key and Certificate

{"The input is not a valid Base-64 string as it contains a non-base 64 character,

more than two padding characters, or an illegal character among the padding characters."}

Thanks,

Azure Key Vault
Azure Key Vault
An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.
1,175 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 60,386 Reputation points
    2024-04-23T22:29:13.5333333+00:00

    as there are only 64 characters in Base64 charset (A-Z,a-z,0-9,+,/) plus the pad char "=". it should be easy to determine the error:

    https://en.wikipedia.org/wiki/Base64

    the length of the unencoded byte array should be a multiple of 3, otherwise padding is required. each char encodes 6 bits.

    0 comments No comments