Class RSAKeyPair


  • public class RSAKeyPair
    extends java.lang.Object
    Key pair for RSA algorithm
    Author:
    Ruslan Nazirov
    • Constructor Summary

      Constructors 
      Constructor Description
      RSAKeyPair()
      Create KeyPair for RSA algorithm
      RSAKeyPair​(java.lang.Integer keySize)
      Create KeyPair for RSA algorithm with specific size
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getEncodedPrivateKey()
      Get encoded private key in string format
      java.lang.String getEncodedPublicKey()
      Get encoded public key in string format
      java.security.PrivateKey getPrivateKey()
      Get private key
      static java.security.PrivateKey getPrivateKey​(java.lang.String privateKey)
      Get private key by its string representation
      java.security.PublicKey getPublicKey()
      Get public key
      static java.security.PublicKey getPublicKey​(java.lang.String publicKey)
      Get public key by its string representation
      • Methods inherited from class java.lang.Object

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

      • RSAKeyPair

        public RSAKeyPair()
                   throws java.lang.Exception
        Create KeyPair for RSA algorithm
        Throws:
        java.lang.Exception - Error during KeyPair generation
      • RSAKeyPair

        public RSAKeyPair​(java.lang.Integer keySize)
                   throws java.lang.Exception
        Create KeyPair for RSA algorithm with specific size
        Parameters:
        keySize - Key size
        Throws:
        java.lang.Exception - Error during KeyPair generation
    • Method Detail

      • getPublicKey

        public java.security.PublicKey getPublicKey()
        Get public key
        Returns:
        publicKey Public key
      • getPublicKey

        public static java.security.PublicKey getPublicKey​(java.lang.String publicKey)
                                                    throws java.lang.Exception
        Get public key by its string representation
        Parameters:
        publicKey - Public key in string format
        Returns:
        key Public key
        Throws:
        java.lang.Exception - Error during acquiring public key
      • getEncodedPublicKey

        public java.lang.String getEncodedPublicKey()
        Get encoded public key in string format
        Returns:
        key Encoded public key in string format
      • getPrivateKey

        public java.security.PrivateKey getPrivateKey()
        Get private key
        Returns:
        privateKey Private key
      • getPrivateKey

        public static java.security.PrivateKey getPrivateKey​(java.lang.String privateKey)
                                                      throws java.lang.Exception
        Get private key by its string representation
        Parameters:
        privateKey - Private key in string format
        Returns:
        key Private key
        Throws:
        java.lang.Exception - Error during acquiring private key
      • getEncodedPrivateKey

        public java.lang.String getEncodedPrivateKey()
        Get encoded private key in string format
        Returns:
        key Encoded private key in string format