Package com.wesabe.grendel.openpgp

Examples of com.wesabe.grendel.openpgp.MessageWriter


      random.nextBytes(original);
    }
   
    @Test
    public void itIsDecryptableByMessageReader() throws Exception {
      final MessageWriter writer = new MessageWriter(owner, ImmutableList.<KeySet>of(recipient), new SecureRandom());
     
      final byte[] encrypted = writer.write(original);
     
      final MessageReader reader = new MessageReader(owner, recipient);
      final byte[] decrypted = reader.read(encrypted);
     
      assertThat(decrypted).isEqualTo(original);
View Full Code Here


    @Test
    public void itCanDecryptIt() throws Exception {
      final byte[] originalBody = "I am a secret document".getBytes();
     
      final MessageWriter writer = new MessageWriter(ownerKeySet.unlock("test".toCharArray()), ImmutableList.of(recipientKeySet), new SecureRandom());
      final byte[] encryptedBody = writer.write(originalBody);
     
      final Field bodyField = doc.getClass().getDeclaredField("body");
      bodyField.setAccessible(true);
      bodyField.set(doc, encryptedBody);
     
View Full Code Here

    final Set<KeySet> recipients = Sets.newHashSetWithExpectedSize(linkedUsers.size());
    for (User linkedUser : linkedUsers) {
      recipients.add(linkedUser.getKeySet());
    }
   
    final MessageWriter writer = new MessageWriter(keySet, recipients, random);
    this.body = writer.write(body);
  }
View Full Code Here

TOP

Related Classes of com.wesabe.grendel.openpgp.MessageWriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.