Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static RSAPublicKey getKey(String filename)
- throws Exception {
- byte[] keyBytes = Files.readAllBytes(Paths.get(filename));
- X509EncodedKeySpec spec =
- new X509EncodedKeySpec(keyBytes);
- KeyFactory kf = KeyFactory.getInstance("RSA");
- return (RSAPublicKey)kf.generatePublic(spec);
- }
- RSAPublicKey pubKey = (RSAPublicKey) GeneraKeysRsa.getKey(file);
- CaviumRSAPublicKey key = (CaviumRSAPublicKey) pubKey;
- ClassCastException: sun.security.rsa.RSAPublicKeyImpl cannot be cast to com.cavium.key.CaviumRSAPublicKey
Add Comment
Please, Sign In to add comment