use of net.i2p.data.SigningPublicKey in project i2p.i2p by i2p.
the class FamilyKeyCrypto method loadCert.
/**
* Load a public key from a cert.
*
* @return null on all errors
*/
private SigningPublicKey loadCert(String familyName) {
if (familyName.contains("/") || familyName.contains("\\") || familyName.contains("..") || (new File(familyName)).isAbsolute())
return null;
familyName = familyName.replace("@", "_at_");
File dir = new File(_context.getBaseDir(), CERT_DIR);
File file = new File(dir, familyName + CERT_SUFFIX);
if (!file.exists())
return null;
try {
PublicKey pk = CertUtil.loadKey(file);
return SigUtil.fromJavaKey(pk);
} catch (GeneralSecurityException gse) {
_log.error("Error loading family key " + familyName, gse);
} catch (IOException ioe) {
_log.error("Error loading family key " + familyName, ioe);
}
return null;
}
Aggregations