android - KeyStore getEntry return null after change password -


hi have program need store key in keystore, generate pair keys , sign value , works time. problem comes when user goes preferences , changes password or change password mode pin mode. after that, when try access private key keystore return me null value.

i know keysotore values signed unlock password value, believed if user changed password keystore resign new key, not case.

i'm doing wrong? if not case, exist way take password change , manually?

this code i'm using.

keypairgenerator kpg = keypairgenerator.getinstance("rsa", "androidkeystore"); kpg.initialize(new keypairgeneratorspec.builder(context)         .setalias(alias)         .setstartdate(now)         .setenddate(end)         .setserialnumber(biginteger.valueof(1))         .setsubject(new x500principal("cn=test1"))         .build());  keypair kp = kpg.generatekeypair(); 

an code of obtain keystore

    keystore ks = keystore.getinstance("androidkeystore");     ks.load(null);     keystore.entry entry = ks.getentry(alias, null);     if (!(entry instanceof keystore.privatekeyentry)) {         log.w("borrar", "not instance of privatekeyentry");         return null;     }  

thank you,


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -