Нет такого алгоритма: RSA-SHA256 для провайдера Cavium - PullRequest
0 голосов
/ 22 октября 2018

Я получаю следующую ошибку без такого алгоритма: RSA-SHA256 для провайдера Cavium

Провайдер уже добавлен в файл java.security

Добавить мой код

String algorithm = "RSA/None/OAEPWithSHA1AndMGF1Padding";
        String provider = "Cavium";
    pubKey = (RSAPublicKey) GeneraKeysRsa.get(file);
        byte[] pubBytes = pubKey.getEncoded();
        KeyFactory kf = KeyFactory.getInstance(algorithm, provider);
        caviumRsa = (CaviumRSAPublicKey) kf.generatePublic(new X509EncodedKeySpec(pubBytes));
        byte[] message = cifrado.encryptCaviumRSA(caviumRsa,json);

Мой звонок ...

public byte[] encryptCaviumRSA(Key key, String plainText) throws NoSuchAlgorithmException,
    NoSuchProviderException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
        String transformation = "RSA/None/OAEPWithSHA1AndMGF1Padding";
        String provider = "Cavium";
            Cipher cipher = Cipher.getInstance(transformation,provider);
            cipher.init(Cipher.ENCRYPT_MODE, key);
            cipher.update(plainText.getBytes());

            byte[] cihperText = cipher.doFinal(plainText.getBytes());
            return cihperText;
    }

Спасибо

...