PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(privateKeyBytes);
                  
                  
                          KeyFactory kf = KeyFactory.getInstance("RSA");
                  
                  
                          PrivateKey privateKey = kf.generatePrivate(spec);
                  
                  
                          
                  
                  
                         Cipher cipher = Cipher.getInstance("RSA");
                  
                  
                         cipher.init(Cipher.DECRYPT_MODE, key);
                  
                  
                         byte[] aesKeyBytes = cipher.doFinal(encryptedAesKeyBytes);
                  
                  
                  
                  
                  
                          SecretKey aesKey = new SecretKeySpec(aesKeyBytes, 0, aesKeyBytes.length, "AES");
                  
                  
                  
                  
                  
                          Cipher cipher = Cipher.getInstance("AES");
                  
                  
                          cipher.init(Cipher.DECRYPT_MODE, aesKey);
                  
                  
                          String data = cipher.doFinal(request);
                  
                  
                
Ручками
именно это чуть ли не один в один матчится
Обсуждают сегодня