Class SAesUtil


  • public class SAesUtil
    extends java.lang.Object
    Author:
    Sokkheang.huo
    • Constructor Summary

      Constructors 
      Constructor Description
      SAesUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String decrypt​(java.lang.String value, java.lang.String encodedBase64Key, java.lang.String encodedBase64Iv)  
      static java.lang.String encrypt​(java.lang.String value, java.lang.String encodedBase64Key, java.lang.String encodedBase64Iv)  
      static java.lang.String makeKeyWithKeyData​(java.lang.String secretKey)  
      static java.lang.String makeRandomKey()  
      static java.lang.String makeRandomKey​(int keySize)  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SAesUtil

        public SAesUtil()
    • Method Detail

      • makeRandomKey

        public static java.lang.String makeRandomKey()
                                              throws SException,
                                                     java.security.NoSuchAlgorithmException
        Throws:
        SException
        java.security.NoSuchAlgorithmException
      • makeRandomKey

        public static java.lang.String makeRandomKey​(int keySize)
                                              throws SException,
                                                     java.security.NoSuchAlgorithmException
        Throws:
        SException
        java.security.NoSuchAlgorithmException
      • makeKeyWithKeyData

        public static java.lang.String makeKeyWithKeyData​(java.lang.String secretKey)
                                                   throws SException
        Throws:
        SException
      • encrypt

        public static java.lang.String encrypt​(java.lang.String value,
                                               java.lang.String encodedBase64Key,
                                               java.lang.String encodedBase64Iv)
                                        throws SException,
                                               javax.crypto.BadPaddingException,
                                               java.security.NoSuchAlgorithmException,
                                               javax.crypto.NoSuchPaddingException,
                                               java.security.InvalidKeyException,
                                               javax.crypto.IllegalBlockSizeException,
                                               java.security.InvalidAlgorithmParameterException
        Throws:
        SException
        javax.crypto.BadPaddingException
        java.security.NoSuchAlgorithmException
        javax.crypto.NoSuchPaddingException
        java.security.InvalidKeyException
        javax.crypto.IllegalBlockSizeException
        java.security.InvalidAlgorithmParameterException
      • decrypt

        public static java.lang.String decrypt​(java.lang.String value,
                                               java.lang.String encodedBase64Key,
                                               java.lang.String encodedBase64Iv)
                                        throws SException,
                                               java.security.NoSuchAlgorithmException,
                                               javax.crypto.NoSuchPaddingException,
                                               java.security.InvalidKeyException,
                                               java.security.InvalidAlgorithmParameterException,
                                               javax.crypto.IllegalBlockSizeException,
                                               javax.crypto.BadPaddingException
        Throws:
        SException
        java.security.NoSuchAlgorithmException
        javax.crypto.NoSuchPaddingException
        java.security.InvalidKeyException
        java.security.InvalidAlgorithmParameterException
        javax.crypto.IllegalBlockSizeException
        javax.crypto.BadPaddingException