Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

NoSuchProviderException #8

Open
joaovictortinoco opened this issue Aug 27, 2017 · 13 comments
Open

NoSuchProviderException #8

joaovictortinoco opened this issue Aug 27, 2017 · 13 comments

Comments

@joaovictortinoco
Copy link

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
Copy link

gmribas commented Oct 18, 2017

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

@micaelomota
Copy link

micaelomota commented Jun 14, 2018

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

@PrinceBE
Copy link

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

@caueferreira
Copy link
Contributor

@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
Copy link

PrinceBE commented Jun 19, 2018

Yes i am getting same exception @caueferreira

@PrinceBE
Copy link

Any one here to help? @caueferreira

@PrinceBE
Copy link

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

@caueferreira
Copy link
Contributor

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

@PrinceBE
Copy link

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
Copy link
Contributor

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

@PrinceBE
Copy link

compileSdkVersion 26
buildToolsVersion "26.0.1"

@PrinceBE
Copy link

Any update from you side??

@caueferreira
Copy link
Contributor

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

5 participants