Java 8 CodeSigner - 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 CodeSigner class.

This code example shows how to use the following methods:equals, hashCode
        Certificate c = cf.generateCertificate(fis);
        fis.close();
        CertPath cp = cf.generateCertPath(Collections.singletonList(c));
 
        // Create a code signer 
        CodeSigner cs = new CodeSigner(cp, new Timestamp(new Date(), cp));
 
        // Serialize the code signer 
        ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream(byteOut);
        out.writeObject(cs);
        out.close();
 
        // Deserialize the code signer 
        byte[] data = byteOut.toByteArray();
        CodeSigner cs2 = (CodeSigner) new ObjectInputStream(
            new ByteArrayInputStream(data)).readObject();
 
        // Test for equality 
        if (!cs.equals(cs2) || cs.hashCode() != cs2.hashCode()) {

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:equals, hashCode
        Certificate c = cf.generateCertificate(fis);
        fis.close();
        CertPath cp = cf.generateCertPath(Collections.singletonList(c));
 
        // Create a code signer 
        CodeSigner cs = new CodeSigner(cp, new Timestamp(new Date(), cp));
 
        // Serialize the code signer 
        ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream(byteOut);
        out.writeObject(cs);
        out.close();
 
        // Deserialize the code signer 
        byte[] data = byteOut.toByteArray();
        CodeSigner cs2 = (CodeSigner) new ObjectInputStream(
            new ByteArrayInputStream(data)).readObject();
 
        // Test for equality 
        if (!cs.equals(cs2) || cs.hashCode() != cs2.hashCode()) {

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:equals
    /** 
     * Test various assertions about equals() 
     */ 
    public final void testEqualsObject() { 
 
        CodeSigner one = new CodeSigner(cpath, ts);
        CodeSigner two = new CodeSigner(cpath, ts);
        CodeSigner three = new CodeSigner(cpath, null);
 
        CertPath cpath2 = TestCertUtils.genCertPath(5, 3);
        CodeSigner four = new CodeSigner(cpath2, null);
 
        assertTrue(one.equals(one));
        assertTrue(one.equals(two));
        assertTrue(two.equals(one));
        assertFalse(one.equals(three));
        assertFalse(three.equals(one));
        assertTrue(three.equals(three));
        // different CertPaths 
        assertFalse( three.equals(four));

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:equals, hashCode
        Certificate c = cf.generateCertificate(fis);
        fis.close();
        CertPath cp = cf.generateCertPath(Collections.singletonList(c));
 
        // Create a code signer 
        CodeSigner cs = new CodeSigner(cp, new Timestamp(new Date(), cp));
 
        // Serialize the code signer 
        ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream(byteOut);
        out.writeObject(cs);
        out.close();
 
        // Deserialize the code signer 
        byte[] data = byteOut.toByteArray();
        CodeSigner cs2 = (CodeSigner) new ObjectInputStream(
            new ByteArrayInputStream(data)).readObject();
 
        // Test for equality 
        if (!cs.equals(cs2) || cs.hashCode() != cs2.hashCode()) {

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:equals
    /** 
     * Test various assertions about equals() 
     */ 
    public final void testEqualsObject() { 
 
        CodeSigner one = new CodeSigner(cpath, ts);
        CodeSigner two = new CodeSigner(cpath, ts);
        CodeSigner three = new CodeSigner(cpath, null);
 
        CertPath cpath2 = TestCertUtils.genCertPath(5, 3);
        CodeSigner four = new CodeSigner(cpath2, null);
 
        assertTrue(one.equals(one));
        assertTrue(one.equals(two));
        assertTrue(two.equals(one));
        assertFalse(one.equals(three));
        assertFalse(three.equals(one));
        assertTrue(three.equals(three));
        // different CertPaths 
        assertFalse( three.equals(four));

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
    /** 
     * Tests CodeSigner.hashCode() 
     */ 
    public void testHashCode() { 
        assertTrue(new CodeSigner(cpath, ts).hashCode() == (cpath.hashCode() ^ ts
                .hashCode()));
        assertTrue(new CodeSigner(cpath, null).hashCode() == cpath.hashCode());
    } 
 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
    protected CodeSigner[] codeSigners() throws Exception {
        CertificateFactory cf = CertificateFactory.getInstance("X.509");
        InputStream is = getClass().getResourceAsStream("/lambdaWorks.p7");
        CertPath certPath = cf.generateCertPath(is, "PKCS7");
        is.close();
        return new CodeSigner[] { new CodeSigner(certPath, null) };
    } 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
     * @see com.intel.drl.test.SerializationTest#getData() 
     */ 
    protected Object[] getData() { 
        CertPath cpath = TestCertUtils.getCertPath(); 
        Timestamp ts = new Timestamp(new Date(1146633204309L), cpath); 
        return new Object[] { new CodeSigner(cpath, ts), 
                new CodeSigner(cpath, null) }; 
    } 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
     * @see com.intel.drl.test.SerializationTest#getData() 
     */ 
    protected Object[] getData() { 
        CertPath cpath = TestCertUtils.getCertPath(); 
        Timestamp ts = new Timestamp(new Date(1146633204309L), cpath); 
        return new Object[] { new CodeSigner(cpath, ts), 
                new CodeSigner(cpath, null) }; 
    } 
} 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
    /** 
     * Tests CodeSigner.hashCode() 
     */ 
    public void testHashCode() { 
        assertTrue(new CodeSigner(cpath, ts).hashCode() == (cpath.hashCode() ^ ts
                .hashCode()));
        assertTrue(new CodeSigner(cpath, null).hashCode() == cpath.hashCode());
    } 
 
} 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Java 8 CodeSigner Methods: