Example usage for org.bouncycastle.openpgp PGPSecretKeyRingCollection removeSecretKeyRing

List of usage examples for org.bouncycastle.openpgp PGPSecretKeyRingCollection removeSecretKeyRing

Introduction

In this page you can find the example usage for org.bouncycastle.openpgp PGPSecretKeyRingCollection removeSecretKeyRing.

Prototype

public static PGPSecretKeyRingCollection removeSecretKeyRing(PGPSecretKeyRingCollection ringCollection,
        PGPSecretKeyRing secretKeyRing) 

Source Link

Document

Return a new collection object containing the contents of this collection with the passed in secret key ring removed.

Usage

From source file:org.jivesoftware.smackx.ox.store.abstr.AbstractOpenPgpKeyStore.java

License:Apache License

@Override
public void deleteSecretKeyRing(BareJid owner, OpenPgpV4Fingerprint fingerprint)
        throws IOException, PGPException {
    PGPSecretKeyRingCollection secretKeyRings = getSecretKeysOf(owner);
    if (secretKeyRings.contains(fingerprint.getKeyId())) {
        secretKeyRings = PGPSecretKeyRingCollection.removeSecretKeyRing(secretKeyRings,
                secretKeyRings.getSecretKeyRing(fingerprint.getKeyId()));
        if (!secretKeyRings.iterator().hasNext()) {
            secretKeyRings = null;/*from  w w  w  .ja va2 s  .  c  o  m*/
        }
        this.secretKeyRingCollections.put(owner, secretKeyRings);
        writeSecretKeysOf(owner, secretKeyRings);
    }
}