Java 8 PSSParameterSpec - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 PSSParameterSpec class.

This code example shows how to use the following methods: getDigestAlgorithm, getMGFParameters, getSaltLength, getTrailerField
        protected byte[] engineGetEncoded()  
            throws IOException 
        { 
            PSSParameterSpec pssSpec = currentSpec;
            AlgorithmIdentifier hashAlgorithm = new AlgorithmIdentifier(
                                                DigestFactory.getOID(pssSpec.getDigestAlgorithm()),
                                                DERNull.INSTANCE); 
            MGF1ParameterSpec mgfSpec = (MGF1ParameterSpec)pssSpec.getMGFParameters();
            AlgorithmIdentifier maskGenAlgorithm = new AlgorithmIdentifier(
                                                PKCSObjectIdentifiers.id_mgf1, 
                                                new AlgorithmIdentifier(DigestFactory.getOID(mgfSpec.getDigestAlgorithm()), DERNull.INSTANCE));
            RSASSAPSSparams pssP = new RSASSAPSSparams(hashAlgorithm, maskGenAlgorithm, new ASN1Integer(pssSpec.getSaltLength()), new ASN1Integer(pssSpec.getTrailerField()));
             
            return pssP.getEncoded("DER");
        } 
     
        protected byte[] engineGetEncoded( 
            String format)
            throws IOException 
        { 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getDigestAlgorithm, getMGFParameters, getSaltLength, getTrailerField
        protected byte[] engineGetEncoded()  
            throws IOException 
        { 
            PSSParameterSpec pssSpec = currentSpec;
            AlgorithmIdentifier hashAlgorithm = new AlgorithmIdentifier(
                                                DigestFactory.getOID(pssSpec.getDigestAlgorithm()),
                                                // BEGIN android-changed 
                                                DERNull.INSTANCE); 
                                                // END android-changed 
            MGF1ParameterSpec mgfSpec = (MGF1ParameterSpec)pssSpec.getMGFParameters();
            AlgorithmIdentifier maskGenAlgorithm = new AlgorithmIdentifier(
                                                PKCSObjectIdentifiers.id_mgf1, 
                                                // BEGIN android-changed 
                                                new AlgorithmIdentifier(DigestFactory.getOID(mgfSpec.getDigestAlgorithm()), DERNull.INSTANCE));
                                                // END android-changed 
            RSASSAPSSparams pssP = new RSASSAPSSparams(hashAlgorithm, maskGenAlgorithm, new ASN1Integer(pssSpec.getSaltLength()), new ASN1Integer(pssSpec.getTrailerField()));
             
            return pssP.getEncoded("DER");
        } 
     
        protected byte[] engineGetEncoded( 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getDigestAlgorithm
    /** 
     * Test for <code>getDigestAlgorithm()</code> method 
     * Assertion: returns message digest algorithm name  
     */ 
    public final void testGetDigestAlgorithm() { 
        PSSParameterSpec pssps = new PSSParameterSpec("SHA-1", "MGF1",
                MGF1ParameterSpec.SHA1, 20, 1);
        assertEquals("SHA-1", pssps.getDigestAlgorithm());
    } 
 
    /** 
     * Test for <code>getMGFAlgorithm()</code> method 
     * Assertion: returns mask generation function algorithm name  
     */ 
    public final void testGetMGFAlgorithm() { 
        PSSParameterSpec pssps = new PSSParameterSpec("SHA-1", "MGF1",
                MGF1ParameterSpec.SHA1, 20, 1);
        assertEquals("MGF1", pssps.getMGFAlgorithm());
    } 
 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getSaltLength
        Signature normalSig = Signature.getInstance(sigName, "BC");
 
        PSSParameterSpec spec = (PSSParameterSpec)normalSig.getParameters().getParameterSpec(PSSParameterSpec.class);
 
        // Make sure we generate the same 'random' salt for both normal and raw signers 
        int saltLen = spec.getSaltLength();
        byte[] fixedRandomBytes = new byte[saltLen];
        random.nextBytes(fixedRandomBytes);
 
        normalSig.initSign(privKey, new FixedSecureRandom(fixedRandomBytes));
        normalSig.update(sampleMessage);
        byte[] normalResult = normalSig.sign();
 
        MessageDigest digest = MessageDigest.getInstance(digestOID.getId(), "BC");
        byte[] hash = digest.digest(sampleMessage);
 
        Signature rawSig = Signature.getInstance("RAWRSASSA-PSS", "BC");
 
        // Need to init the params explicitly to avoid having a 'raw' variety of every PSS algorithm 
        rawSig.setParameter(spec);
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getTrailerField
    /** 
     * 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());
    } 
 
    /** 
     * Test for <code>DEFAULT</code> field<br> 
     * Assertion: default message digest algorithm name is "SHA-1" 
     */ 
    public final void testDEFAULTmdName() { 
        assertEquals("SHA-1", PSSParameterSpec.DEFAULT.getDigestAlgorithm());
    } 
 
    /** 
     * Test for <code>DEFAULT</code> field<br> 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
See Code Examples for Java 8 PSSParameterSpec Methods: