This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
My pgp fingerprint is BF71 A5E8 E8CD 553B DE86 0969 62F4 63C6 73F6 C01F |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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:<....> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |