It is illegal if you are carrying anything against school policy, such as a blade. That being said you really should focus more on the actual issue of cutting, the dangers and how to correct it. Not be trying to find ways to do it at school.
You should never resort to self harm. I know you may just read it and ignore that but instead of doing self harm you should find a more effective means of solving your problems. By saying you want to self harm at school probably means you stress out or something happens there. Instead of harming yourself find a creative way to deal with the problem. For example listening to music, drawing, or keeping a journal. When you are feeling down and dont feel like talking to anyone then write it down on your notebook and examine your thoughts. It will let you vent wherever you go. If youre scared someone might read it, write it in a code that only you understand. There are more positive ways to deal with problems but these are just a few. Also if you're feeling sad, go out for a nice walk and observe nature and the beauty of life; from the chirp of the flying birds to the sound and feel of the cool fresh wind touching your skin. If you want to talk, just send me a message. Im here for you :)