Class CryptoRegistry


  • public final class CryptoRegistry
    extends java.lang.Object
    A registry of crypto algorithm. The registry is pre-wired with RSA and EdDSA implementations. It also supports registration of additional algorithms
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Crypto cryptoFor​(io.token.proto.common.security.SecurityProtos.Key.Algorithm algorithm)
      Returns a crypto by proto algorithm type.
      Crypto cryptoFor​(CryptoType type)
      Returns a crypto by algorithm name.
      static CryptoRegistry getInstance()
      Returns the instance of the registry singleton.
      Crypto tryCryptoFor​(io.token.proto.common.security.SecurityProtos.Key.Algorithm algorithm)
      Returns a crypto by proto algorithm type.
      • Methods inherited from class java.lang.Object

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

      • getInstance

        public static CryptoRegistry getInstance()
        Returns the instance of the registry singleton.
        Returns:
        the singleton instance
      • cryptoFor

        public Crypto cryptoFor​(CryptoType type)
        Returns a crypto by algorithm name.
        Parameters:
        type - crypto type
        Returns:
        a crypto
      • cryptoFor

        public Crypto cryptoFor​(io.token.proto.common.security.SecurityProtos.Key.Algorithm algorithm)
        Returns a crypto by proto algorithm type.
        Parameters:
        algorithm - the proto algorithm
        Returns:
        an optional crypto; empty otherwise
      • tryCryptoFor

        @Nullable
        public Crypto tryCryptoFor​(io.token.proto.common.security.SecurityProtos.Key.Algorithm algorithm)
        Returns a crypto by proto algorithm type.
        Parameters:
        algorithm - the proto algorithm
        Returns:
        an optional crypto; empty otherwise