code: public final byte[] wrap(Key key)
              throws IllegalBlockSizeException, InvalidKeyException {
          if (!(this instanceof NullCipher)) {
              if (!initialized) {
                  throw new IllegalStateException("Cipher not initialized");
              }
              if (opmode != Cipher.WRAP_MODE) {
                  throw new IllegalStateException("Cipher not initialized " +
                                                  "for wrapping keys");
              }
          }
  
          updateProviderIfNeeded();
          return spi.engineWrap(key);
      }
docs: Wrap a key.
  
  @param key the key to be wrapped.
  
  @return the wrapped key.
  
  @exception IllegalStateException if this cipher is in a wrong
  state (e.g., has not been initialized).
  
  @exception IllegalBlockSizeException if this cipher is a block
  cipher, no padding has been requested, and the length of the
  encoding of the key to be wrapped is not a
  multiple of the block size.
  
  @exception InvalidKeyException if it is impossible or unsafe to
  wrap the key with this cipher (e.g., a hardware protected key is
  being passed to a software-only cipher).