The PKCS8Key class implements the InternalPrivateKey interface that specifies the calculatePublicKey() method. This method, however, is not implemented by XDHPrivateKeyImpl or ECPrivateKey that extend PKCS8Key. Calling it throws and UnsupportedOperationException.