protected void engineinitverify(publickey publickey) throws invalidkeyexception { cipherparameters param; if (publickey instanceof ecpublickey) { param = ecutil.generatepublickeyparameter(publickey); } else if (publickey instanceof gost3410key) { param = gost3410util.generatepublickeyparameter(publickey); } else { try { byte[] bytes = publickey.getencoded(); publickey = bouncycastleprovider.getpublickey(subjectpublickeyinfo.getinstance(bytes)); if (publickey instanceof ecpublickey) { param = ecutil.generatepublickeyparameter(publickey); } else { throw new invalidkeyexception("can't recognise key type in dsa based signer"); } } catch (exception e) { throw new invalidkeyexception("can't recognise key type in dsa based signer"); } } digest.reset(); signer.init(false, param); }
protected void engineinitsign(privatekey privatekey) throws invalidkeyexception { cipherparameters param; if (privatekey instanceof eckey) { param = ecutil.generateprivatekeyparameter(privatekey); } else { param = gost3410util.generateprivatekeyparameter(privatekey); } digest.reset(); if (random != null) { signer.init(true, new parameterswithrandom(param, random)); } else { signer.init(true, param); } }