wirecardBrasil / moip-encryption-sdk-android

Cliente Android para integração com as APIs v2 Moip, possibilita a criptografia de dados sensíveis de cartão de crédito.
20 stars 6 forks source link

NoSuchProviderException #8

Open joaovictortinoco opened 7 years ago

joaovictortinoco commented 7 years ago

Hello! I've followed the guidelines of the MOIP integration but during the encryption process i got this log:

java.security.NoSuchProviderException: No such provider: SC 08-27 02:01:10.610 4430-4430/com.br.pckshop W/System.err: at javax.crypto.Cipher.getInstance(Cipher.java:855) 08-27 02:01:10.610 4430-4430/com.br.pckshop W/System.err: at br.com.moip.encryption.entities.CreditCard.encrypt(CreditCard.java:111)

gmribas commented 7 years ago

@joaovictortinoco adding Security.addProvider(BouncyCastleProvider()) before creditCard.encrypt() worked for me.

micaelomota commented 6 years ago

I'm also getting this problem. I've tried to use @joaovictortinoco's sugestion, but what is BouncyCastleProvider()?

PrinceBE commented 6 years ago

I am also getting this Problem Added this line Security.addProvider(BouncyCastleProvider()) Still problem didn't resolved please help us.

caueferreira commented 6 years ago

@PrinceBE Security.addProvider(new BouncyCastleProvider()); should do the trick. Are you getting the same exception?

@micaelomota
BouncyCastleProvider() is an instance of the bouncy castle library that allows the encryptor to proper cryptography the credit card data.

PrinceBE commented 6 years ago

Yes i am getting same exception @caueferreira

PrinceBE commented 6 years ago

Any one here to help? @caueferreira

PrinceBE commented 6 years ago

Its been a week and since no reply from your side. A bad support from your team.

caueferreira commented 6 years ago

I've just created a simple application. @PrinceBE did you added the BouncyCastleProvider() within the same activity you call encrypt() method?

PrinceBE commented 6 years ago

Yes I added below snippet to encrypt the card CreditCard creditCard = new CreditCard(); creditCard.setCvc(cvc.getText().toString()); creditCard.setNumber(cardNumber.getText().toString()); creditCard.setExpirationMonth(String.valueOf(month)); creditCard.setExpirationYear(String.valueOf(year)); creditCard.setPublicKey(MOIP_PUBLIC_KEY); try { String encryptedKey = creditCard.encrypt(); } catch (MoipEncryptionException e) { e.printStackTrace(); }

Added this line in activity's Oncreate: Security.addProvider(new BouncyCastleProvider());

caueferreira commented 6 years ago

That's weird... Which android sdk version are you compiling? I can't recreate this error.

PrinceBE commented 6 years ago

compileSdkVersion 26 buildToolsVersion "26.0.1"

PrinceBE commented 6 years ago

Any update from you side??

caueferreira commented 6 years ago

I've just added a working app. Could you see if it works for you? If so, I'll merge it afterwards. https://github.com/moip/moip-encryption-sdk-android/tree/add-simple-app