Code example for X509EncodedKeySpec

Methods: getEncoded

0
     * Assertion: returns encoded key 
     */ 
    public final void testGetEncoded() { 
        byte[] encodedKey = new byte[] {(byte)1,(byte)2,(byte)3,(byte)4};
         
        X509EncodedKeySpec eks = new X509EncodedKeySpec(encodedKey);
         
        byte[] ek = eks.getEncoded();
         
        assertTrue(Arrays.equals(encodedKey, ek));
    } 
 
    /** 
     * Test for <code>getFormat()</code> method 
     * Assertion: returns format name (always "X.509") 
     */ 
    public final void testGetFormat() { 
        byte[] encodedKey = new byte[] {(byte)1,(byte)2,(byte)3,(byte)4};
         
        X509EncodedKeySpec meks = new X509EncodedKeySpec(encodedKey);