private static Map<SignatureAlgorithm, PSSParameterSpec> createPssParameterSpecs() { Map<SignatureAlgorithm, PSSParameterSpec> m = new HashMap<SignatureAlgorithm, PSSParameterSpec>(); MGF1ParameterSpec ps = MGF1ParameterSpec.SHA256; PSSParameterSpec spec = new PSSParameterSpec(ps.getDigestAlgorithm(), "MGF1", ps, 32, 1); m.put(SignatureAlgorithm.PS256, spec); ps = MGF1ParameterSpec.SHA384; spec = new PSSParameterSpec(ps.getDigestAlgorithm(), "MGF1", ps, 48, 1); m.put(SignatureAlgorithm.PS384, spec); ps = MGF1ParameterSpec.SHA512; spec = new PSSParameterSpec(ps.getDigestAlgorithm(), "MGF1", ps, 64, 1); m.put(SignatureAlgorithm.PS512, spec); return m; }
public static byte[] signPSS(PrivateKey privateKey, byte[] signedData) throws SignatureException, InvalidKeyException, NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException { Signature signature = Signature.getInstance("SHA256withRSA/PSS", BC); signature.setParameter(new PSSParameterSpec("SHA-256", "MGF1", new MGF1ParameterSpec("SHA-256"), 32, 1)); signature.initSign(privateKey); signature.update(signedData); return signature.sign(); }
public static byte[] signPSS(PrivateKey privateKey, byte[] signedData) throws SignatureException, InvalidKeyException, NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException { Signature signature = Signature.getInstance("SHA256withRSA/PSS", BC); signature.setParameter(new PSSParameterSpec("SHA-256", "MGF1", new MGF1ParameterSpec("SHA-256"), 32, 1)); signature.initSign(privateKey); signature.update(signedData); return signature.sign(); }
public static boolean verifyPSS(PublicKey publicKey, byte[] signedData, byte[] sig) throws SignatureException, InvalidKeyException, NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException, InvalidKeySpecException { Signature signature = Signature.getInstance("SHA256withRSA/PSS", BC); signature.setParameter(new PSSParameterSpec("SHA-256", "MGF1", new MGF1ParameterSpec("SHA-256"), 32, 1)); signature.initVerify(publicKey); signature.update(signedData); return signature.verify(sig); }
public SHA512_224withRSA() { super(new RSABlindedEngine(), new PSSParameterSpec("SHA-512(224)", "MGF1", new MGF1ParameterSpec("SHA-512(224)"), 28, 1)); } }
public SHA3_224withRSA() { super(new RSABlindedEngine(), new PSSParameterSpec("SHA3-224", "MGF1", new MGF1ParameterSpec("SHA3-224"), 28, 1)); } }
public SHA3_256withRSA() { super(new RSABlindedEngine(), new PSSParameterSpec("SHA3-256", "MGF1", new MGF1ParameterSpec("SHA3-256"), 32, 1)); } }
public RsaPssSha256() { super(AlgorithmIdentifiers.RSA_PSS_USING_SHA256, choosePssAlgorithmName("SHA256withRSAandMGF1")); MGF1ParameterSpec mgf1pec = MGF1ParameterSpec.SHA256; PSSParameterSpec pssSpec = new PSSParameterSpec(mgf1pec.getDigestAlgorithm(), MGF1, mgf1pec, 32, TRAILER); setAlgorithmParameterSpec(pssSpec); } }
public RsaPssSha512() { super(AlgorithmIdentifiers.RSA_PSS_USING_SHA512, choosePssAlgorithmName("SHA512withRSAandMGF1")); MGF1ParameterSpec mgf1pec = MGF1ParameterSpec.SHA512; PSSParameterSpec pssSpec = new PSSParameterSpec(mgf1pec.getDigestAlgorithm(), MGF1, mgf1pec, 64, TRAILER); setAlgorithmParameterSpec(pssSpec); } }
public SHA3_256withRSA() { super(new RSABlindedEngine(), new PSSParameterSpec("SHA3-256", "MGF1", new MGF1ParameterSpec("SHA3-256"), 32, 1)); } }
public SHA512withRSA() { super(new RSABlindedEngine(), new PSSParameterSpec("SHA-512", "MGF1", new MGF1ParameterSpec("SHA-512"), 64, 1)); } }
public SHA512_256withRSA() { super(new RSABlindedEngine(), new PSSParameterSpec("SHA-512(256)", "MGF1", new MGF1ParameterSpec("SHA-512(256)"), 32, 1)); } }
public SHA3_512withRSA() { super(new RSABlindedEngine(), new PSSParameterSpec("SHA3-512", "MGF1", new MGF1ParameterSpec("SHA3-512"), 64, 1)); } }
public SHA256withRSA() { super(new RSABlindedEngine(), new PSSParameterSpec("SHA-256", "MGF1", new MGF1ParameterSpec("SHA-256"), 32, 1)); } }
public SHA512withRSA() { super(new RSABlindedEngine(), new PSSParameterSpec("SHA-512", "MGF1", new MGF1ParameterSpec("SHA-512"), 64, 1)); } }
public SHA3_224withRSA() { super(new RSABlindedEngine(), new PSSParameterSpec("SHA3-224", "MGF1", new MGF1ParameterSpec("SHA3-224"), 28, 1)); } }
public SHA224withRSA() { super(new RSABlindedEngine(), new PSSParameterSpec("SHA-224", "MGF1", new MGF1ParameterSpec("SHA-224"), 28, 1)); } }
public SHA512_224withRSA() { super(new RSABlindedEngine(), new PSSParameterSpec("SHA-512(224)", "MGF1", new MGF1ParameterSpec("SHA-512(224)"), 28, 1)); } }
public SHA512_256withRSA() { super(new RSABlindedEngine(), new PSSParameterSpec("SHA-512(256)", "MGF1", new MGF1ParameterSpec("SHA-512(256)"), 32, 1)); } }
protected AlgorithmParameterSpec createPSSParam(DigestAlgorithm digestAlgo) { String digestJavaName = digestAlgo.getJavaName(); return new PSSParameterSpec(digestJavaName, "MGF1", new MGF1ParameterSpec(digestJavaName), digestAlgo.getSaltLength(), 1); } }