public void encryptAndSign(GnuPGKey[] recipients, GnuPGData plain, GnuPGData cipher) throws GnuPGException { if (hasNoRecipients(recipients) || plain == null || cipher == null) throw new GnuPGException("Encryption-Arguments not complete."); gpgmeOpEncryptSign( this.getInternalRepresentation(), getInternalRepresentationFromRecipients(recipients), plain.getInternalRepresentation(), cipher.getInternalRepresentation()); }
/** * Encrypts the data from <em>plain</em> with the public key of each recipient. The result is * stored in <em>cipher</em>. * * @param recipients Array with the public keys of all recipients * @param plain text, that should be encrypted * @param cipher text, the encrypted plain text after method call * @see com.freiheit.gnupg.GnuPGData * @see com.freiheit.gnupg.GnuPGKey */ public void encrypt(GnuPGKey[] recipients, GnuPGData plain, GnuPGData cipher) throws GnuPGException { if (hasNoRecipients(recipients) || plain == null || cipher == null) throw new GnuPGException("Encryption arguments not complete."); // note that these are pointers to addresses in the javagnupg shared lib long context = this.getInternalRepresentation(); if (gpgmeGetSignersLength(context) == 0) gpgmeOpEncrypt( context, getInternalRepresentationFromRecipients(recipients), plain.getInternalRepresentation(), cipher.getInternalRepresentation()); else gpgmeOpEncryptSign( context, getInternalRepresentationFromRecipients(recipients), plain.getInternalRepresentation(), cipher.getInternalRepresentation()); }