/**
   Copyright 2017 Carlos Macasaet

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       https://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 */
package com.macasaet.fernet;

import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.Base64.getUrlDecoder;
import static java.util.Base64.getUrlEncoder;

import java.nio.charset.Charset;
import java.util.Base64.Decoder;
import java.util.Base64.Encoder;

import javax.crypto.Cipher;

/**
 * This contains common values used throughout the framework.
 *
 * <p>Copyright &copy; 2017 Carlos Macasaet.</p>
 * @author Carlos Macasaet
 */
class Constants {

    public static final Charset charset = UTF_8;
    public static final Encoder encoder = getUrlEncoder();
    public static final Decoder decoder = getUrlDecoder();
    /**
     * The algorithm used to encrypt the token contents.
     */
    public static final String encryptionAlgorithm = "AES";
    /**
     * The algorithm used to sign the token.
     */
    public static final String signingAlgorithm = "HmacSHA256";
    /**
     * The number of bytes used to store the encryption initialisation vector
     */
    public static final int initializationVectorBytes = 16;
    /**
     * The number of bytes used to store the timestamp of a Fernet token.
     */
    public static final int timestampBytes = 8;
    /**
     * The number of bytes used to indicate the version of a Fernet token.
     */
    public static final int versionBytes = 1;
    /**
     * The number of bytes before the cipher text portion of a Fernet token.
     */
    public static final int tokenPrefixBytes = versionBytes + timestampBytes + initializationVectorBytes;
    /**
     * The number of bytes in a valid signing key.
     */
    public static final int signingKeyBytes = 16;
    /**
     * The number of bytes in a valid encryption key.
     */
    public static final int encryptionKeyBytes = 16;
    /**
     * The total number of bytes in a valid Fernet key.
     */
    public static final int fernetKeyBytes = signingKeyBytes + encryptionKeyBytes;
    /**
     * The AES block size used by the cipher.
     */
    public static final int cipherTextBlockSize = 16;
    /**
     * The transformation (algorithm, mode, and padding) used by the cipher.
     * 
     * @see Cipher#getInstance(String)
     */
    public static final String cipherTransformation = encryptionAlgorithm + "/CBC/PKCS5Padding";
    /**
     * The number of bytes for the HMAC signature.
     */
    public static final int signatureBytes = 32;
    /**
     * The Fernet token version supported by this library.
     */
    public static final byte supportedVersion = (byte) 0x80;
    /**
     * The number of bytes in the static portion of the token (excludes cipher text).
     */
    public static final int tokenStaticBytes = versionBytes + timestampBytes + initializationVectorBytes + signatureBytes;
    /**
     * The minimum number of bytes in a token (i.e. with an empty plaintext).
     */
    public static final int minimumTokenBytes = tokenStaticBytes + cipherTextBlockSize;

    private Constants() {
    }

}
@@ -1063,31 +1063,24 @@
 ants %7B%0A%0A    
-public 
 static final
@@ -1105,31 +1105,24 @@
  UTF_8;%0A    
-public 
 static final
@@ -1157,31 +1157,24 @@
 oder();%0A    
-public 
 static final
@@ -1278,39 +1278,32 @@
 ts.%0A     */%0A    
-public 
 static final Str
@@ -1392,39 +1392,32 @@
 en.%0A     */%0A    
-public 
 static final Str
@@ -1543,39 +1543,32 @@
 tor%0A     */%0A    
-public 
 static final int
@@ -1686,39 +1686,32 @@
 en.%0A     */%0A    
-public 
 static final int
@@ -1818,39 +1818,32 @@
 en.%0A     */%0A    
-public 
 static final int
@@ -1950,39 +1950,32 @@
 en.%0A     */%0A    
-public 
 static final int
@@ -2116,39 +2116,32 @@
 ey.%0A     */%0A    
-public 
 static final int
@@ -2229,39 +2229,32 @@
 ey.%0A     */%0A    
-public 
 static final int
@@ -2347,39 +2347,32 @@
 ey.%0A     */%0A    
-public 
 static final int
@@ -2485,39 +2485,32 @@
 er.%0A     */%0A    
-public 
 static final int
@@ -2672,39 +2672,32 @@
 ng)%0A     */%0A    
-public 
 static final Str
@@ -2829,39 +2829,32 @@
 re.%0A     */%0A    
-public 
 static final int
@@ -2946,39 +2946,32 @@
 ry.%0A     */%0A    
-public 
 static final byt
@@ -3102,39 +3102,32 @@
 t).%0A     */%0A    
-public 
 static final int
@@ -3324,15 +3324,8 @@
     
-public 
 stat
@@ -3431,9 +3431,10 @@
 %0A    %7D%0A%0A
-
 %7D
+%0A

Integrate Sonar