Code example for PKCS8EncodedKeySpec

Methods: getFormat

0
     * Assertion: returns format name (always "PKCS#8") 
     */ 
    public final void testGetFormat() { 
        byte[] encodedKey = new byte[] {(byte)1,(byte)2,(byte)3,(byte)4};
         
        PKCS8EncodedKeySpec meks = new PKCS8EncodedKeySpec(encodedKey);
         
        assertEquals("PKCS#8", meks.getFormat());
    } 
     
    /** 
     * Tests that internal state of the object 
     * can not be changed by modifying initial 
     * array value 
     */ 
    public final void testIsStatePreserved1() { 
        // Reference array 
        byte[] encodedKey = new byte[] {(byte)1,(byte)2,(byte)3,(byte)4};
        // Reference array's copy will be used for test 
        byte[] encodedKeyCopy = encodedKey.clone();