View gist:c05dca103a252ac0d6ac
My pgp fingerprint is BF71 A5E8 E8CD 553B DE86 0969 62F4 63C6 73F6 C01F
View Gen.java
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.File;
import java.io.Reader;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.StreamTokenizer;
View PF1Coder.java
// PF1-encoding for PGP fingerprints; optimized to fit
// within a Version 2 QR code using M-level error-correction
//
// Format is simple.
// PF1:<32 characters -- Base32 (rfc4648) encoded 160 bit fingerprint>
//
// To test:
//
// $ java PF1Coder encode <40-character hex fingerprint>
// PF1:<....>
View gist:5725808
package org.ppdrive.crypto;
import org.bouncyrattle.bcpg.ContainedPacket;
import org.bouncyrattle.bcpg.PublicKeyEncSessionPacket;
import org.bouncyrattle.openpgp.PGPException;
import org.bouncyrattle.openpgp.PGPPublicKey;
import org.bouncyrattle.openpgp.operator.bc.BcPublicKeyKeyEncryptionMethodGenerator;
class CAnonymousPublicKeyKeyEncryptionMethodGenerator
extends BcPublicKeyKeyEncryptionMethodGenerator
View gist:5725725
package org.ppdrive.crypto;
import java.io.File;
import java.io.FileInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.math.BigInteger;
import java.security.SecureRandom;
View CKeystore.java
// Underhanded skullduggery to access the keystore daemon.
//
// This is merely a slightly cleaned up implementation of
// http://nelenkov.blogspot.com/2012/05/storing-application-secrets-in-androids.html
// and all credit to Nikolay for digging into this.
package org.kbsriram.android.util;
import android.content.Context;
import android.content.Intent;
View gist:4074271
/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
View gist:2050672
import org.bouncycastle.openpgp.operator.bc.BcPublicKeyKeyEncryptionMethodGenerator;
import org.bouncycastle.openpgp.PGPPublicKey;
import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.bcpg.ContainedPacket;
import org.bouncycastle.bcpg.PublicKeyEncSessionPacket;
public class CAnonymousPublicKeyKeyEncryptionMethodGenerator
extends BcPublicKeyKeyEncryptionMethodGenerator
{
public CAnonymousPublicKeyKeyEncryptionMethodGenerator(PGPPublicKey key)
View gist:2030426
private static void genCert
(String id, String pass, File pubfile, File secfile)
throws Exception
{
KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA", "BC");
kpg.initialize(2048);
KeyPair sign_pair = kpg.generateKeyPair();
KeyPair enc_pair = kpg.generateKeyPair();