Wednesday, 22 April 2026

Generate Secure Files using PGP (Pretty Good Privacy)

Pretty Good Privacy (PGP) is a data encryption program used for signing, encrypting, and decrypting emails, files, and text to ensure secure communication.

Generating a PGP (Pretty Good Privacy) file involves creating an RSA key pair and then using that key to encrypt or sign data. While PowerShell doesn't have a "native" PGP command, the industry standard is to use GnuPG (gpg) via PowerShell.

Process to set up RSA 2048 keys and generate PGP files

1. Install GnuPG
Before starting, ensure you have GPG installed. The most common version for Windows is Gpg4win.
Check installation: Open PowerShell and type gpg --version
> Install if missing: 
winget install GnuPG.GnuPG
> Or install from: 
https://www.gnupg.org/download/

2. Generate RSA 2048 Key Pair
We will use the --full-generate-key command to ensure we specify the RSA algorithm and 2048-bit size.
> Run the following command:
gpg --full-generate-key
> Follow the prompts:
Selection: Select (1) RSA and RSA (default).
Key size: Type 2048.
Validity: Choose how long the key should last (e.g., 0 for no expiration).
Identity: Enter your Name and Email address.
Passphrase: Enter a strong password to protect your private key.

3. Exporting the Keys (Generating .asc Files)
PGP files are often shared as ASCII-armored (.asc) files. You’ll need to export your public key to share it with others.
> Export Public Key:
gpg --armor --export "your-email@example.com" > MyPublicKey.asc
> Export Private Key (Backup only!):
gpg --armor --export-secret-keys "your-email@example.com" > MyPrivateKey.asc

4. Encrypting a File (Generating .pgp/.gpg Files)
Once your keys are set up, you can generate an encrypted PGP file from any document.
Encrypt a file for yourself
            > If you want to encrypt a file so only you can open it: (A new file named document.txt.gpg will be created)
gpg --recipient "your-email@example.com" --encrypt "C:\path\to\document.txt"


Very Important
Encrypt a file for someone else
To encrypt a file for a colleague, you must first import their public key:
> Import their key: gpg --import their_key.asc
> Encrypt for them:
gpg --recipient "colleague@example.com" --encrypt "SecretData.docx"

Summary Table of PowerShell Commands
Generate Key gpg --full-generate-key
List Keys gpg --list-keys
Export Public Key gpg --armor --export [ID] > public.asc
Encrypt File gpg --recipient [ID] --encrypt [filename]
Decrypt File gpg --decrypt [filename].gpg > original.txt


Very Important
Security Tip: Never share your Private Key (.asc or .gpg). If you lose your private key or your passphrase, you will lose access to any files encrypted with that key pair forever.



Sunday, 5 April 2026

Setup Data API Builder (DAB)

 1. Create a .env file and paste these lines inside it:

conn ="Server=localhost,1433;
          User ID=<UserName>;
          Password='<Password>';
          Database=<DB_Name>;
          TrustServerCertificate=True;
          Encrypt=True;"

ASPNETCORE_URLS=http://<Server>:<Port>

2. Initialize DAB - this will create 

dab init --database-type "mssql" --host-mode "Development" --connection-string "@env('conn')"

3. Add entity to the DAB dab-config.json

dab add <Name> --source dbo.<TableName> --permissions "anonymous:*"

4. Start DAB

dab start

5. Make sure the tables in the database have the PK; otherwise, the DAB won't start


USEFUL URLS:

  • http://localhost:5000/api/<Entity>
  • http://localhost:5000/api/<Entity>/id/4
  • http://localhost:5000/api/<Entity>?$select=Name&$filter=where predicate
  • http://localhost:5000/graphql/
  • http://localhost:5000/swagger/index.html


Reference: 



Saturday, 28 March 2026

Saturday, 7 February 2026

Windows Problem Steps Recorder

Windows Problem Steps Recorder (PSR) is a built-in Windows utility that automatically captures screenshots and annotates steps to help troubleshoot issues or document processes.


Monday, 26 January 2026

Google Search Hack

linux -mint +ubuntu "best"

  • - exclude phrase
  • + include phrase
  • "" find exact match

Saturday, 3 January 2026

Generate QR Code in MS Word

  • Press CTRL + F9
  • Inside the braces, type: {displaybarcode”your-website.domain”qr\q3}
  • Press ALT + F9 to generate the QR code

Thursday, 4 December 2025

Google Form using App Script

  • Create a Google Sheet with the following headers: First Name, Last Name, DoB
  • Create a Google Form with the exact headers as Google Sheet headers:  First Name, Last Name, DoB
  • In Google Form, create an App Script Trigger as follows - this code will link the data in the Form to the created Google Sheet:

function onFormSubmit(event)
{
record_array = []
var form = FormApp.openById('Form Id in Edit Mode'); // Form ID
var formResponses = form.getResponses();
var formCount = formResponses.length;
// get the latest form response
var formResponse = formResponses[formCount - 1];
var itemResponses = formResponse.getItemResponses();
for (var j = 0; j < itemResponses.length; j++) {
var itemResponse = itemResponses[j];
var title = itemResponse.getItem().getTitle();
var answer = itemResponse.getResponse();
Logger.log(title);
Logger.log(answer);
record_array.push(answer);
}
AddRecord(record_array[0], record_array[1], record_array[2]);
}
function AddRecord(first_name, last_name, dob) {
var url = 'https://'; //URL OF GOOGLE SHEET;
var ss= SpreadsheetApp.openByUrl(url);
var dataSheet = ss.getSheetByName("Sheet1");
dataSheet.appendRow([first_name, last_name, dob, new Date()]);
}

 

Generate Secure Files using PGP (Pretty Good Privacy)

Pretty Good Privacy (PGP) is a data encryption program used for signing, encrypting, and decrypting emails, files, and text to ensure secure...