Class RSAPublicKey

java.lang.Object
marauroa.common.crypto.RSAPublicKey
Direct Known Subclasses:
RSAKey

public class RSAPublicKey extends Object
Implementation of a RSA key.
Author:
quisar
  • Field Details

  • Constructor Details

    • RSAPublicKey

      public RSAPublicKey(BigInteger n, BigInteger e)
      creates a new RSAPublicKey object
      Parameters:
      n - n
      e - e
  • Method Details

    • print

      public void print(PrintWriter out)
      prints the key to a writer
      Parameters:
      out - writer to print to
    • print

      public void print(PrintStream out)
      prints the key to a stream
      Parameters:
      out - stream to print to
    • getN

      public BigInteger getN()
      gets n
      Returns:
      n
    • getE

      public BigInteger getE()
      get e
      Returns:
      e
    • encode

      public BigInteger encode(BigInteger message)
      encodes a BigInteger
      Parameters:
      message - BigInteger
      Returns:
      encoded BigInteger
    • encodeByteArray

      public byte[] encodeByteArray(byte[] message)
      encodes an array
      Parameters:
      message - array
      Returns:
      encoded array
    • verifySignature

      public boolean verifySignature(BigInteger message, BigInteger signature)
      verifies a signature
      Parameters:
      message - BigInteger
      signature - BigInteger
      Returns:
      true, if the signature is correct; false otherwise
    • getValue

      public static BigInteger getValue(String str)
      converts a string into a BigInteger
      Parameters:
      str - to convert
      Returns:
      BigInteger
    • getString

      public static String getString(BigInteger value)
      converts a BigInteger into a string
      Parameters:
      value - BigInteger
      Returns:
      String