小编goo*_*er4的帖子

使用 RSA 的音频加密

当我运行下面的代码时,解密的长度与原始长度不同。所以无法读取音频。

我收到此错误:javax.sound.sampled.UnsupportedAudioFileException:无法从输入流获取音频输入流

at javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1119)
at MainClass.main(MainClass.java:119)
Run Code Online (Sandbox Code Playgroud)

我的代码在这里:

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import javax.sound.sampled.AudioFileFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;

public class MainClass {
public static final int SIZE = 1024;

private BigInteger p, q, n, totient, e, d;
private Random rnd = new Random();

public MainClass() {

    p = new BigInteger(1024, 10, new Random());
    do {
        q = new BigInteger(1024, 10, new Random());
    } while (p.equals(q));

    n = p.multiply(q);

    totient = (p.subtract(BigInteger.ONE)).multiply(q …
Run Code Online (Sandbox Code Playgroud)

java cryptography rsa

1
推荐指数
1
解决办法
1600
查看次数

标签 统计

cryptography ×1

java ×1

rsa ×1