base64 Archives - TEKSpace Blog https://blog.tekspace.io/tag/base64/ Tech tutorials for Linux, Kubernetes, PowerShell, and Azure Wed, 30 Aug 2023 02:41:23 +0000 en-US hourly 1 https://wordpress.org/?v=6.8.1 https://blog.tekspace.io/wp-content/uploads/2023/09/cropped-Tekspace-logo-icon-32x32.png base64 Archives - TEKSpace Blog https://blog.tekspace.io/tag/base64/ 32 32 Linux Base64 encoding and decoding string value https://blog.tekspace.io/linux-base64-encoding-and-decoding-string-value/ https://blog.tekspace.io/linux-base64-encoding-and-decoding-string-value/#respond Mon, 14 Sep 2020 19:12:15 +0000 https://blog.tekspace.io/index.php/2020/09/14/linux-base64-encoding-and-decoding-string-value/ Base64 encoding is a method of encoding binary data into an ASCII (text-based) format. In Linux and other computing environments, Base64 encoding is commonly used to represent binary data in a human-readable form. This encoding is used for different purposes. It encodes binary files for transmission over protocols that use text. It can also embed

The post Linux Base64 encoding and decoding string value appeared first on TEKSpace Blog.

]]>
Base64 encoding is a method of encoding binary data into an ASCII (text-based) format. In Linux and other computing environments, Base64 encoding is commonly used to represent binary data in a human-readable form. This encoding is used for different purposes. It encodes binary files for transmission over protocols that use text. It can also embed binary data in text-based formats like JSON or XML.

Base64 encoding converts groups of 3 bytes (24 bits) from binary data into 4 characters from a set of 64 predefined characters, which usually include uppercase letters, lowercase letters, digits, and a few special characters. When the length of binary data is not divisible by 3, padding characters, often represented by the symbol ‘=’, are added to the encoded output. This ensures that the total number of characters is a multiple of 4.

From the Linux command line interface, execute the below commands to encode or decode string values.

Encoding

echo -n 'tekspace' | base64

Output:

dGVrc3BhY2U=

Decoding

echo -n dGVrc3BhY2U= | base64 -d

Output:

tekspace

The post Linux Base64 encoding and decoding string value appeared first on TEKSpace Blog.

]]>
https://blog.tekspace.io/linux-base64-encoding-and-decoding-string-value/feed/ 0
Convert certificate from pfx to base64 with PowerShell https://blog.tekspace.io/convert-certificate-from-pfx-to-base64-with-powershell/ https://blog.tekspace.io/convert-certificate-from-pfx-to-base64-with-powershell/#respond Thu, 15 Feb 2018 19:44:25 +0000 https://blog.tekspace.io/index.php/2018/02/15/convert-certificate-from-pfx-to-base64-with-powershell/ To convert a certificate that is in .pfx to base64 format in PowerShell, you can use .NET namespace available in PowerShell to convert. I had a scenario where I was required to use base64 encoding to upload a certificate to Azure to secure communication to backend instance. Since Microsoft Azure provides a rich API to

The post Convert certificate from pfx to base64 with PowerShell appeared first on TEKSpace Blog.

]]>
To convert a certificate that is in .pfx to base64 format in PowerShell, you can use .NET namespace available in PowerShell to convert. I had a scenario where I was required to use base64 encoding to upload a certificate to Azure to secure communication to backend instance. Since Microsoft Azure provides a rich API to work with. I was able to make a patch request and push a certificate to Azure.

In this tutorial, I will show you how to convert a certificate from .pfx to base64.

Open PowerShell as an administrator.

Now that we have a PowerShell console opened. Let’s first load the content into a variable.

$pfx_cert = get-content 'c:\certificate.pfx' -Encoding Byte

The above command will load the content with byte encoding. If you print $pfx_cert in the PowerShell console, you will see random numbers. In order to convert to base64 format, we will use system namespace from Windows system.

To convert a certificate in base64, execute the below command.

$base64 = [System.Convert]::ToBase64String($pfx_cert)

The above command will save it in $base64 variable, and now you can use this variable or output it to a file depending on your scenario.

The post Convert certificate from pfx to base64 with PowerShell appeared first on TEKSpace Blog.

]]>
https://blog.tekspace.io/convert-certificate-from-pfx-to-base64-with-powershell/feed/ 0