PostgreSQL Database encryption at rest

The threat model is very important in this case as encrypting a database efficiently is not an easy task, this can be done at 3 different layers (client-application, storage-device, data-base-itself) note that in all cases if the client application is compromised the encryption is useless, self data base encryption solution cover the least threat models … Read more

How to sign a JWT using RS256 with RSA private key

I know this post is old, but it took me forever to figure this out, so I thought I would share. To test I created RSA keys using OpenSSL: openssl genrsa -out privateKey.pem 512 openssl rsa -in privateKey.pem -pubout -out publicKey.pem You will need the following 2 nuget packages: https://github.com/dvsekhvalnov/jose-jwt http://www.bouncycastle.org/csharp/ Test Code public static … Read more

implement RSA in .NET core

You should avoid using RSACryptoServiceProvider if you can. It only works on Windows (and it’s the less good RSA implementation on Windows). Stick to the RSA base class, and create new instances via RSA.Create() Ephemeral Keys (Creation) .NET Core using (RSA rsa = RSA.Create()) { rsa.KeySize = desiredKeySizeInBits; // when the key next gets used … Read more

How does Maven 3 password encryption work?

My answer is based on reading the Maven source code and doing a little research. Does the encrypted master password provide security simply by existing in settings-security.xml in a folder that only one user can access (~/.m2)? If so, why bother with encrypting a ‘master password’ (why not just use some random value)? Isn’t the … Read more

Generate RSA key pair and encode public as string

For output as Hex-String import java.security.*; public class Test { public static void main(String[] args) throws NoSuchAlgorithmException, NoSuchProviderException { KeyPairGenerator keyGen = KeyPairGenerator.getInstance(“RSA”); keyGen.initialize(512); byte[] publicKey = keyGen.genKeyPair().getPublic().getEncoded(); StringBuffer retString = new StringBuffer(); for (int i = 0; i < publicKey.length; ++i) { retString.append(Integer.toHexString(0x0100 + (publicKey[i] & 0x00FF)).substring(1)); } System.out.println(retString); } } For output as … Read more

App Store – Help answering “Missing Compliance” (using Expo + Firebase)

Question 1: Reply YES as you use HTTPS encryption for connections Question 2: For what you said about your app the reply is NO. In brief you don’t use any function inside your app that use a custom cryptography or it’s strictly medical app. The encryption that you use it’s only for data passing from … Read more

Python’s safest method to store and retrieve passwords from a database

Store the password+salt as a hash and the salt. Take a look at how Django does it: basic docs and source. In the db they store <type of hash>$<salt>$<hash> in a single char field. You can also store the three parts in separate fields. The function to set the password: def set_password(self, raw_password): import random … Read more