Search in sources :

Example 1 with DigestAlgorithmIdentifierFinder

use of com.github.zhenwei.pkix.operator.DigestAlgorithmIdentifierFinder in project LinLong-Java by zhenwei1108.

the class JcaContentSignerBuilder method createPSSParams.

private static RSASSAPSSparams createPSSParams(PSSParameterSpec pssSpec) {
    DigestAlgorithmIdentifierFinder digFinder = new DefaultDigestAlgorithmIdentifierFinder();
    AlgorithmIdentifier digId = digFinder.find(pssSpec.getDigestAlgorithm());
    if (digId.getParameters() == null) {
        digId = new AlgorithmIdentifier(digId.getAlgorithm(), DERNull.INSTANCE);
    }
    AlgorithmIdentifier mgfDig = digFinder.find(((MGF1ParameterSpec) pssSpec.getMGFParameters()).getDigestAlgorithm());
    if (mgfDig.getParameters() == null) {
        mgfDig = new AlgorithmIdentifier(mgfDig.getAlgorithm(), DERNull.INSTANCE);
    }
    return new RSASSAPSSparams(digId, new AlgorithmIdentifier(PKCSObjectIdentifiers.id_mgf1, mgfDig), new ASN1Integer(pssSpec.getSaltLength()), new ASN1Integer(pssSpec.getTrailerField()));
}
Also used : RSASSAPSSparams(com.github.zhenwei.core.asn1.pkcs.RSASSAPSSparams) ASN1Integer(com.github.zhenwei.core.asn1.ASN1Integer) DigestAlgorithmIdentifierFinder(com.github.zhenwei.pkix.operator.DigestAlgorithmIdentifierFinder) DefaultDigestAlgorithmIdentifierFinder(com.github.zhenwei.pkix.operator.DefaultDigestAlgorithmIdentifierFinder) DefaultDigestAlgorithmIdentifierFinder(com.github.zhenwei.pkix.operator.DefaultDigestAlgorithmIdentifierFinder) AlgorithmIdentifier(com.github.zhenwei.core.asn1.x509.AlgorithmIdentifier)

Aggregations

ASN1Integer (com.github.zhenwei.core.asn1.ASN1Integer)1 RSASSAPSSparams (com.github.zhenwei.core.asn1.pkcs.RSASSAPSSparams)1 AlgorithmIdentifier (com.github.zhenwei.core.asn1.x509.AlgorithmIdentifier)1 DefaultDigestAlgorithmIdentifierFinder (com.github.zhenwei.pkix.operator.DefaultDigestAlgorithmIdentifierFinder)1 DigestAlgorithmIdentifierFinder (com.github.zhenwei.pkix.operator.DigestAlgorithmIdentifierFinder)1