mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-12-08 03:51:09 +01:00
Fix message sending, filebased store storage
This commit is contained in:
parent
ffc8cbbf79
commit
48862962db
8 changed files with 54 additions and 7 deletions
|
|
@ -143,10 +143,7 @@ public class BCOpenPgpProvider implements OpenPgpProvider {
|
|||
Streams.pipeAll(decrypted, decryptedOut);
|
||||
|
||||
return new OpenPgpMessage(OpenPgpMessage.State.signcrypt, new String(decryptedOut.toByteArray(), Charset.forName("UTF-8")));
|
||||
} catch (IOException e) {
|
||||
// TODO: Hm...
|
||||
return null;
|
||||
} catch (NoSuchProviderException e) {
|
||||
} catch (IOException | NoSuchProviderException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -346,6 +346,7 @@ public class FileBasedBcOpenPgpStore implements BCOpenPgpStore {
|
|||
}
|
||||
primaryKeyFingerprint = selectedKey;
|
||||
writePrivateKeysToFile(keyringConfig, secretKeyringPath());
|
||||
writePublicKeysToFile(keyring, publicKeyringPath());
|
||||
}
|
||||
} catch (PGPException | IOException e) {
|
||||
throw new SmackOpenPgpException(e);
|
||||
|
|
@ -359,6 +360,8 @@ public class FileBasedBcOpenPgpStore implements BCOpenPgpStore {
|
|||
PGPSecretKeyRing ourKey = BCOpenPgpProvider.generateKey(user).generateSecretKeyRing();
|
||||
keyringConfig.addSecretKey(ourKey.getSecretKey().getEncoded());
|
||||
keyringConfig.addPublicKey(ourKey.getPublicKey().getEncoded());
|
||||
writePrivateKeysToFile(keyringConfig, secretKeyringPath());
|
||||
writePublicKeysToFile(keyringConfig, publicKeyringPath());
|
||||
primaryKeyFingerprint = BCOpenPgpProvider.getFingerprint(ourKey.getPublicKey());
|
||||
return primaryKeyFingerprint;
|
||||
} catch (PGPException | IOException e) {
|
||||
|
|
@ -456,7 +459,8 @@ public class FileBasedBcOpenPgpStore implements BCOpenPgpStore {
|
|||
BufferedOutputStream bufferedStream = new BufferedOutputStream(outputStream);
|
||||
|
||||
bufferedStream.write(bytes);
|
||||
outputStream.close();
|
||||
bufferedStream.flush();
|
||||
bufferedStream.close();
|
||||
} catch (IOException e) {
|
||||
if (outputStream != null) {
|
||||
outputStream.close();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue