Donald's Bacon Bytes

bytes of information as tasty as bacon

Dill Coleslaw

Topic: Cooking | Tags:

Aug
17
2016

Coleslaw

Whenever I make some kind of pork bbq, I like to have some coleslaw with my meal. Whether it be pulled pork (with or without a bun) or a bacon wrapped fatty. My favorite is to do a dill coleslaw. It’s pretty simple. Just put the cabbage in a big bowl, mix the other ingredients together in a different bowl and pour the sauce over the cabbage.

  • 1/2 cup mayonnaise (I use an olive oil based mayo)
  • 1/4 cup cider vinegar
  • 1/4 teaspoon celery seed
  • 2 tablespoons sugar
  • 1 tbsp dill weed
  • 1 tsp chili powder
  • 1/4 teaspoon sea salt
  • 1/4 teaspoon pepper
  • 12 oz bag of cabbage mix


Memphis Dust Meat Rub

Topic: Cooking | Tags:

Aug
14
2016

MemphisDust
One of my favorite sites to read is AmazingRibs.com. Yes, you are on my blog and I’m telling you about a different site. I might even have some similar content but I’ll have variations and original stuff as well …

Read full story



Create JWT with a Private RSA Key

Topic: Development | Tags: ,

Aug
11
2016

Recently I ran into a challenge at work and that I had hard time figuring out how to solve. We have an authenticate server written in NodeJS. It signs a user into our application and creates a JWT. This application signs the JWT with a PEM file which ONLY has a Private RSA Key. Our C# API can use the corresponding certificate file (.cer) to validate the token when it is passed in each API call.

This has been working great. For reasons I’m not going to get into here, we had to come up with a way to create a token from our Asp.Net admin that would allow someone to login as a specific user without logging in. We are doing this for a demo type of user account. The challenge was that I couldn’t find any good examples that would allow me to create the JWT using only the PEM file. I found hints here and there but nothing exact.

The solution I came up with was to use a combination of Bouncy Castle and Jose JWT. I used Bouncy Castle to create the signing key and then Jose JWT to encode the token.

public static string CreateToken(List<Claim> claims, string certificateName, string rootFolder, string certificateFolder = "Certificates")
 { 
 string path = Path.Combine(rootFolder, certificateFolder, certificateName);
 string pemString = File.ReadAllText(path);
 string jwt = string.Empty;
 AsymmetricCipherKeyPair keyPair;

 using (StreamReader sr = new StreamReader(path))
 {
 PemReader pr = new PemReader(sr);
 keyPair = (AsymmetricCipherKeyPair)pr.ReadObject();
 } 
 
 RSAParameters rsaParams = DotNetUtilities.ToRSAParameters((RsaPrivateCrtKeyParameters)keyPair.Private);

 using (RSACryptoServiceProvider rsa = new RSACryptoServiceProvider())
 {
 rsa.ImportParameters(rsaParams);
 Dictionary<string, object> payload = claims.ToDictionary(k => k.Type, v => (object)v.Value);
 jwt = Jose.JWT.Encode(payload, rsa, Jose.JwsAlgorithm.RS256);
 }

 return jwt;
 }

As you can see, this is a somewhat generic method that takes in the path to the certificate along with the claims and then creates the JWT out of that information.

Anyway, I hope this can help others.

If you have other suggestions, I’d love to hear them in the comments.



Wet Cured Bacon

Topic: Cooking | Tags: ,

Aug
07
2016

SlicedWetCuredBacon_intro
Man do I love some good bacon. I’ve been dry curing bacon for a few years now and decided I wanted to try doing a wet cure. I came across a great thread about this over at SmokingMeatForums.com and decided to give it a try.

Wow! It was amazing!! …

Read full story



London Broil Skewers

Topic: Cooking | Tags:

Jul
31
2016

introImage
I’m a big fan of beef but it can be expensive. So, I usually look for sales and then figure out how to use that meat to make a delicious meal. Recently there was a great sale on London Broil. It is a great piece of meat for grilling and it works well with marinade …

Read full story