public static PGPSecretKey readSecretKey(InputStream in, long keyId) throws IOException, PGPException {
InputStream decoderStream = null;
try {
decoderStream = PGPUtil.getDecoderStream(in);
PGPSecretKeyRingCollection pgpSec = new PGPSecretKeyRingCollection(decoderStream);
PGPSecretKey key = null;
Iterator rIt = pgpSec.getKeyRings();
while (key == null && rIt.hasNext()) {
PGPSecretKeyRing kRing = (PGPSecretKeyRing) rIt.next();
Iterator kIt = kRing.getSecretKeys();
while (key == null && kIt.hasNext()) {
PGPSecretKey k = (PGPSecretKey) kIt.next();