Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem replacing deprecated method with suggested replacement #4

Open
ericlw opened this issue Apr 22, 2016 · 0 comments
Open

Problem replacing deprecated method with suggested replacement #4

ericlw opened this issue Apr 22, 2016 · 0 comments

Comments

@ericlw
Copy link

ericlw commented Apr 22, 2016

Using KeyGenParameterSpec.Builder makes keys unable to decrypt, any thoughts?

             if(Build.VERSION.SDK_INT <= 18) {
                    Calendar start = Calendar.getInstance();
                    Calendar end = Calendar.getInstance();
                    end.add(Calendar.YEAR, 1);

                    KeyPairGeneratorSpec spec = new KeyPairGeneratorSpec.Builder(this)
                            .setAlias(alias)
                            .setSubject(new X500Principal("CN=Sample Name, O=Android Authority"))
                            .setSerialNumber(BigInteger.ONE)
                            .setStartDate(start.getTime())
                            .setEndDate(end.getTime())
                            .build();

                    generator.initialize(spec);
                }
                else {

                    generator.initialize(new KeyGenParameterSpec.Builder
                            (alias, KeyProperties.PURPOSE_SIGN)
                            .setDigests(KeyProperties.DIGEST_SHA256)
                            .setSignaturePaddings(KeyProperties.SIGNATURE_PADDING_RSA_PKCS1)
                            .build());

                }

                KeyPair keyPair = generator.generateKeyPair();

http://stackoverflow.com/questions/36802523/keypairgeneratorspec-replacement-with-keygenparameterspec-builder-equivalents

@ericlw ericlw changed the title Problem replaced deprecated method with suggested replacement Problem replacing deprecated method with suggested replacement Apr 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant