use of java.security.spec.PSSParameterSpec in project jjwt by jwtk.
the class RsaProvider method createSignatureInstance.
protected Signature createSignatureInstance() {
Signature sig = super.createSignatureInstance();
PSSParameterSpec spec = PSS_PARAMETER_SPECS.get(alg);
if (spec != null) {
setParameter(sig, spec);
}
return sig;
}
use of java.security.spec.PSSParameterSpec in project jjwt by jwtk.
the class RsaProvider method createPssParameterSpecs.
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;
}
use of java.security.spec.PSSParameterSpec in project robovm by robovm.
the class PSSParameterSpecTest method testGetTrailerField.
/**
* Test for <code>getTrailerField()</code> method<br>
* Assertion: returns trailer field value
*/
public final void testGetTrailerField() {
PSSParameterSpec pssps = new PSSParameterSpec("SHA-1", "MGF1", MGF1ParameterSpec.SHA1, 20, 1);
assertEquals(1, pssps.getTrailerField());
}
use of java.security.spec.PSSParameterSpec in project robovm by robovm.
the class OperatorHelper method createRawSignature.
public Signature createRawSignature(AlgorithmIdentifier algorithm) {
Signature sig;
try {
String algName = getSignatureName(algorithm);
algName = "NONE" + algName.substring(algName.indexOf("WITH"));
sig = helper.createSignature(algName);
// the AlgorithmIdentifier parameters field MUST contain RSASSA-PSS-params.
if (algorithm.getAlgorithm().equals(PKCSObjectIdentifiers.id_RSASSA_PSS)) {
AlgorithmParameters params = helper.createAlgorithmParameters(algName);
params.init(algorithm.getParameters().toASN1Primitive().getEncoded(), "ASN.1");
PSSParameterSpec spec = (PSSParameterSpec) params.getParameterSpec(PSSParameterSpec.class);
sig.setParameter(spec);
}
} catch (Exception e) {
return null;
}
return sig;
}
use of java.security.spec.PSSParameterSpec in project j2objc by google.
the class PSSParameterSpecTest method testGetTrailerField.
/**
* Test for <code>getTrailerField()</code> method<br>
* Assertion: returns trailer field value
*/
public final void testGetTrailerField() {
PSSParameterSpec pssps = new PSSParameterSpec("SHA-1", "MGF1", MGF1ParameterSpec.SHA1, 20, 1);
assertEquals(1, pssps.getTrailerField());
}
Aggregations