Example usage for org.bouncycastle.openpgp PGPSecretKeyRingCollection encode

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

Introduction

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

Prototype

public void encode(OutputStream outStream) throws IOException 

Source Link

Usage

From source file:org.jivesoftware.smackx.ox.store.filebased.FileBasedOpenPgpKeyStore.java

License:Apache License

@Override
public void writeSecretKeysOf(BareJid owner, PGPSecretKeyRingCollection secretKeys) throws IOException {
    File file = getSecretKeyRingPath(owner);

    if (secretKeys == null) {
        FileUtils.maybeDeleteFileOrThrow(file);
        return;/*  ww w . j a  v a  2s.c o  m*/
    }

    OutputStream outputStream = null;
    try {
        outputStream = FileUtils.prepareFileOutputStream(file);
        secretKeys.encode(outputStream);
    } finally {
        CloseableUtil.maybeClose(outputStream, LOGGER);
    }
}