/* (C) 2014 Peter Conrad
 * All rights reserved.
 */
package de.quisquis.ec.impl.pp;

import de.quisquis.ec.Decrypter;

import java.security.PrivateKey;
import java.security.PublicKey;

import java.security.interfaces.ECPrivateKey;

/**
 *
 * @author Peter Conrad
 */
public class CryptoppDecrypter implements Decrypter {
    private final EcData keyData;

    public CryptoppDecrypter(PrivateKey priv, PublicKey pub) {
        keyData = new EcData((ECPrivateKey) priv);
    }

    @Override
    public byte[] decrypt(byte[] ciphertext) {
        return CryptoppNative.decrypt(ciphertext, keyData.curveModulus,
                                      keyData.curveA, keyData.curveB,
                                      keyData.gX, keyData.gY, keyData.n,
                                      keyData.x);
    }
}

@@ -544,14 +544,23 @@
     
-return
+byte result%5B%5D =
  Cry
@@ -643,32 +643,41 @@
                 
+       
+  
 keyData.curveA, 
@@ -692,16 +692,25 @@
 curveB,%0A
+         
         
@@ -762,17 +762,16 @@
 Data.gY,
- 
 keyData.
@@ -803,32 +803,41 @@
                 
+         
 keyData.x);%0A    
@@ -832,16 +832,146 @@
 ata.x);%0A
+        if (result == null) %7B%0A            throw new IllegalStateException(%22Decryption failed!%22);%0A        %7D%0A        return result;%0A
     %7D%0A%7D%0A

Throw exception if native returns null, until native is fixed