Skip to content

Instantly share code, notes, and snippets.

kennwhite

Block or report user

Report or block kennwhite

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kennwhite
kennwhite / southern_biscuits.md
Last active Dec 19, 2019
Easy southern biscuits
View southern_biscuits.md

Southern Biscuits

Ingredients

  • 3 cups SELF-RISING White Lilly flour
  • 3 Tbsp sugar
  • 1/2 tsp salt
  • 1/2 tsp cream of tartar
  • 3/4 cup COLD or FROZEN salted butter
  • 1 egg
  • 2/3 cup whole milk
@kennwhite
kennwhite / SecurityProvidersAndAlgorithms.java
Created Dec 4, 2019 — forked from nicoulaj/SecurityProvidersAndAlgorithms.java
List all Java Security providers and algorithms available in the environment.
View SecurityProvidersAndAlgorithms.java
import java.security.Provider;
import java.security.Security;
import java.util.Enumeration;
public class SecurityProvidersAndAlgorithms {
public static void main(String[] args) throws Exception {
try {
Provider p[] = Security.getProviders();
for (int i = 0; i < p.length; i++) {
System.out.println(p[i]);
@kennwhite
kennwhite / collection_schema_with_keyid.json
Created Oct 28, 2019
JSON Schema example for CSFE using metadata and json pointer keyId
View collection_schema_with_keyid.json
{
"bsonType" : "object",
"encryptMetadata" : {
"keyId" : "/userid",
"algorithm" : "AEAD_AES_256_CBC_HMAC_SHA_512-Random"
},
"properties" : {
"ssn" : {
"encrypt" : {
"bsonType" : "string"
@kennwhite
kennwhite / hello_world_python.py
Last active Nov 24, 2019
Hello World Python (Python v. 2 or 3)
View hello_world_python.py
# Simple hello world for MongoDB client-side field level encryption using Python
#
# Python installer requires PIP v 19+ (pip --version)
# sudo apt remove python-pip
# sudo apt remove python3-pip
# curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && sudo python get-pip.py && sudo python3 get-pip.py
# python -m pip install pymongo
# python -m pip install pymongocrypt
#
@kennwhite
kennwhite / hello_world_node.js
Last active Sep 14, 2019
Client Side Field Level Encryption Hello World for Node.js
View hello_world_node.js
// Simple Client-Side Field Level Encryption example for Node.js
// To install: mkdir proj; cp hello_fle_node.js proj; cd proj; npm install mongodb mongodb-client-encryption --save; node hello_fle_node.js
const dbName = 'demoFLE';
const keyCollection = dbName + '.__keystore'
const dataCollection = 'people'
const url = "mongodb+srv://username:password@xxx.example.net/" + dbName; // 'mongodb://localhost'
const AWS_ACCESS_KEY = "AKIxxxxxxxxxxxxxxxxx"
@kennwhite
kennwhite / hello_world_shell_local.js
Last active Nov 27, 2019
MongoDB Client Side Field Level Encryption Quickstart Part 2 (local key version)
View hello_world_shell_local.js
/*
Simple demonstration using MongoDB Client-Side Field Level Encryption (local key version)
Requires Community or (preferrably) Enterprise Shell and a MongoDB 4.2+ database
Local, stand-alone, or Atlas MongoDB will all work.
To use this, just open Mongo shell, with this file, e.g.:
mongo --nodb --shell hello_world_shell_local.js
# For a self-signed cert: mongo --tls --tlsCAFile /opt/mongodb/certs/ca.pem --shell hello_world_shell_local.js
@kennwhite
kennwhite / hello_world_shell_kms.js
Last active Oct 16, 2019
MongoDB Client Side Field Level Encryption Quickstart Part 2 (KMS version)
View hello_world_shell_kms.js
// Simple demonstration using MongoDB Client-Side Field Level Encryption (KMS version)
// Requires Community or (preferrably) Enterprise Shell and a MongoDB 4.2+ database
// Local, stand-alone, or Atlas MongoDB will all work.
// To use this, just open Mongo shell, with this file, e.g.: `mongo localhost --shell hello_world_shell_kms.js`
// Note, you will need the attached `kms_config.env` file, see below.
// See: Client-Side Field Level Encryption Quickstart Part 1:
// https://gist.github.com/kennwhite/e64e5b6770e89a797c3a08ecaa0cb7d0
var demoDB = "demoFLE"
@kennwhite
kennwhite / client_side_fle_quickstart-part-1.md
Last active Sep 5, 2019
MongoDB Client-Side Field Level Encryption Quickstart Part 1
View client_side_fle_quickstart-part-1.md

Client-Side Field Level Encryption Quickstart Part 1

Note: See KMS Best Practices guide for more specific guidance:

You should work to ensure that the corresponding key policies follow a model of least privilege. This includes ensuring that you do NOT include kms:* permissions in an IAM policy.

Note: This tutorial will create both an AWS KMS master key as well as a local key. If planning to use only a local key, skip to Step 4.

1. Create a project-specific Master Key

  • In the AWS management console, create a project-specific master key:
    • Key Management Service (KMS) / Customer managed keys / Create a key
@kennwhite
kennwhite / seafood_paella.md
Last active Jul 27, 2019
Classic seafood paella
View seafood_paella.md

Paella - 2:1 bone broth to rice (short grain Spanish) ratio

  • Sauté 1/2 lg yellow onion chopped in 2 TB olive oil w/ 6 lg cloves minced garlic, 1 cored & seeded jalapeño. Remove when translucent, ~5 mins
  • Add 2 c rice (maybe to a clean pan with no oil) to toast, approx 3 mins
  • Add 3-4 small chopped vine tomatoes (about 2/3 cup), onions, bone broth, 2 lg pinches crushed Spanish saffron, 1 tsp sweet paprika, 1/2 tsp dried rosemary
  • Simmer 18 mins on low heat, covered
  • Add seafood (lobster, bay scallops, tail-on large shrimp; stir well)
  • Continue simmer uncovered for 5 mins. Rice should have mostly absorbed liquid, still slightly soupy
  • Move pan to 375° oven for 15-20 mins until baked well on top
  • Squeeze lemon, garnish with lemon wedges, black pepper, salt to taste (original called for 3 tsp — way too much)
You can’t perform that action at this time.