Java Code Examples for org.bitcoinj.core.ECKey#KeyIsEncryptedException

The following examples show how to use org.bitcoinj.core.ECKey#KeyIsEncryptedException . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DecryptingKeyBag.java    From bcm-android with GNU General Public License v3.0 5 votes vote down vote up
@Nullable
private ECKey maybeDecrypt(ECKey key) {
    if (key == null)
        return null;
    else if (key.isEncrypted()) {
        if (aesKey == null)
            throw new ECKey.KeyIsEncryptedException();
        return key.decrypt(aesKey);
    } else {
        return key;
    }
}
 
Example 2
Source File: DecryptingKeyBag.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
@Nullable
private ECKey maybeDecrypt(ECKey key) {
    if (key == null)
        return null;
    else if (key.isEncrypted()) {
        if (aesKey == null)
            throw new ECKey.KeyIsEncryptedException();
        return key.decrypt(aesKey);
    } else {
        return key;
    }
}
 
Example 3
Source File: DecryptingKeyBag.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
@Nullable
private ECKey maybeDecrypt(ECKey key) {
    if (key == null)
        return null;
    else if (key.isEncrypted()) {
        if (aesKey == null)
            throw new ECKey.KeyIsEncryptedException();
        return key.decrypt(aesKey);
    } else {
        return key;
    }
}
 
Example 4
Source File: IPaymentChannelClient.java    From bcm-android with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Increments the total value which we pay the server. Note that the amount of money sent may not be the same as the
 * amount of money actually requested. It can be larger if the amount left over in the channel would be too small to
 * be accepted by the Bitcoin network. ValueOutOfRangeException will be thrown, however, if there's not enough money
 * left in the channel to make the payment at all. Only one payment can be in-flight at once. You have to ensure
 * you wait for the previous increase payment future to complete before incrementing the payment again.
 *
 * @param size How many satoshis to increment the payment by (note: not the new total).
 * @param info Information about this update, used to extend this protocol.
 * @return a future that completes when the server acknowledges receipt and acceptance of the payment.
 * @throws ValueOutOfRangeException      If the size is negative or would pay more than this channel's total value
 *                                       ({@link PaymentChannelClientConnection#state()}.getTotalValue())
 * @throws IllegalStateException         If the channel has been closed or is not yet open
 *                                       (see {@link PaymentChannelClientConnection#getChannelOpenFuture()} for the second)
 * @throws ECKey.KeyIsEncryptedException If the keys are encrypted and no AES key has been provided,
 */
ListenableFuture<PaymentIncrementAck> incrementPayment(Coin size, @Nullable ByteString info,
                                                       @Nullable KeyParameter userKey)
        throws ValueOutOfRangeException, IllegalStateException, ECKey.KeyIsEncryptedException;
 
Example 5
Source File: IPaymentChannelClient.java    From green_android with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Increments the total value which we pay the server. Note that the amount of money sent may not be the same as the
 * amount of money actually requested. It can be larger if the amount left over in the channel would be too small to
 * be accepted by the Bitcoin network. ValueOutOfRangeException will be thrown, however, if there's not enough money
 * left in the channel to make the payment at all. Only one payment can be in-flight at once. You have to ensure
 * you wait for the previous increase payment future to complete before incrementing the payment again.
 *
 * @param size How many satoshis to increment the payment by (note: not the new total).
 * @param info Information about this update, used to extend this protocol.
 * @throws ValueOutOfRangeException If the size is negative or would pay more than this channel's total value
 *                                  ({@link PaymentChannelClientConnection#state()}.getTotalValue())
 * @throws IllegalStateException If the channel has been closed or is not yet open
 *                               (see {@link PaymentChannelClientConnection#getChannelOpenFuture()} for the second)
 * @throws ECKey.KeyIsEncryptedException If the keys are encrypted and no AES key has been provided,
 * @return a future that completes when the server acknowledges receipt and acceptance of the payment.
 */
ListenableFuture<PaymentIncrementAck> incrementPayment(Coin size, @Nullable ByteString info,
                                                       @Nullable KeyParameter userKey)
        throws ValueOutOfRangeException, IllegalStateException, ECKey.KeyIsEncryptedException;
 
Example 6
Source File: IPaymentChannelClient.java    From GreenBits with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Increments the total value which we pay the server. Note that the amount of money sent may not be the same as the
 * amount of money actually requested. It can be larger if the amount left over in the channel would be too small to
 * be accepted by the Bitcoin network. ValueOutOfRangeException will be thrown, however, if there's not enough money
 * left in the channel to make the payment at all. Only one payment can be in-flight at once. You have to ensure
 * you wait for the previous increase payment future to complete before incrementing the payment again.
 *
 * @param size How many satoshis to increment the payment by (note: not the new total).
 * @param info Information about this update, used to extend this protocol.
 * @throws ValueOutOfRangeException If the size is negative or would pay more than this channel's total value
 *                                  ({@link PaymentChannelClientConnection#state()}.getTotalValue())
 * @throws IllegalStateException If the channel has been closed or is not yet open
 *                               (see {@link PaymentChannelClientConnection#getChannelOpenFuture()} for the second)
 * @throws ECKey.KeyIsEncryptedException If the keys are encrypted and no AES key has been provided,
 * @return a future that completes when the server acknowledges receipt and acceptance of the payment.
 */
ListenableFuture<PaymentIncrementAck> incrementPayment(Coin size, @Nullable ByteString info,
                                                       @Nullable KeyParameter userKey)
        throws ValueOutOfRangeException, IllegalStateException, ECKey.KeyIsEncryptedException;