Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License");

import java.security.GeneralSecurityException;

public class Main {
    /**
     * @throws GeneralSecurityException if the {@code sizeInBytes} is not a valid AES key size.
     */
    public static void validateAesKeySize(int sizeInBytes) throws GeneralSecurityException {
        if (sizeInBytes != 16 && sizeInBytes != 24 && sizeInBytes != 32) {
            throw new GeneralSecurityException("invalid Aes key size");
        }
    }
}