Class AsymmetricEncryptUtils

java.lang.Object
software.nectar.java.utils.AsymmetricEncryptUtils

public class AsymmetricEncryptUtils
extends java.lang.Object
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected static java.lang.String ALGORITHM  
  • Constructor Summary

    Constructors 
    Constructor Description
    AsymmetricEncryptUtils()  
  • Method Summary

    Modifier and Type Method Description
    static byte[] decodeBASE64​(java.lang.String text)  
    static byte[] decrypt​(byte[] text, java.security.Key key)  
    static java.lang.String decrypt​(java.lang.String text, java.security.Key key)  
    static java.lang.String encodeBASE64​(byte[] bytes)  
    static byte[] encrypt​(byte[] text, java.security.Key key)  
    static java.lang.String encrypt​(java.lang.String text, java.security.Key key)  
    static java.lang.String getKeyAsString​(java.security.Key key)  
    static java.security.PrivateKey getPrivateKeyFromString​(java.lang.String key)  
    static java.security.PublicKey getPublicKeyFromString​(java.lang.String key)  
    static void init()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • init

      public static void init()
    • encrypt

      public static java.lang.String encrypt​(java.lang.String text, java.security.Key key) throws java.lang.Exception
      Throws:
      java.lang.Exception
    • encrypt

      public static byte[] encrypt​(byte[] text, java.security.Key key) throws java.lang.Exception
      Throws:
      java.lang.Exception
    • decrypt

      public static java.lang.String decrypt​(java.lang.String text, java.security.Key key) throws java.lang.Exception
      Throws:
      java.lang.Exception
    • decrypt

      public static byte[] decrypt​(byte[] text, java.security.Key key) throws java.lang.Exception
      Throws:
      java.lang.Exception
    • getKeyAsString

      public static java.lang.String getKeyAsString​(java.security.Key key)
    • getPrivateKeyFromString

      public static java.security.PrivateKey getPrivateKeyFromString​(java.lang.String key) throws java.lang.Exception
      Throws:
      java.lang.Exception
    • getPublicKeyFromString

      public static java.security.PublicKey getPublicKeyFromString​(java.lang.String key) throws java.lang.Exception
      Throws:
      java.lang.Exception
    • encodeBASE64

      public static java.lang.String encodeBASE64​(byte[] bytes)
    • decodeBASE64

      public static byte[] decodeBASE64​(java.lang.String text)