Class SigUtil


  • public final class SigUtil
    extends java.lang.Object
    Utility functions to convert to and from signature-related proto.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static EllipticCurves.CurveType toCurveType​(com.google.crypto.tink.proto.EllipticCurveType type)
      Converts protobuf enum EllipticCurveType to raw Java enum {code CurveType}.
      static EllipticCurves.EcdsaEncoding toEcdsaEncoding​(com.google.crypto.tink.proto.EcdsaSignatureEncoding encoding)
      Converts protobuf enum EcdsaSignatureEncoding to raw Java enum {code EllipticCurves.EcdsaEncoding}.
      static Enums.HashType toHashType​(com.google.crypto.tink.proto.HashType hash)
      Converts protobuf enum HashType to raw Java enum Enums.HashType.
      static com.google.protobuf.ByteString toUnsignedIntByteString​(java.math.BigInteger i)
      Returns the unsigned byte representation of the input BigInteger.
      • Methods inherited from class java.lang.Object

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

      • toHashType

        public static Enums.HashType toHashType​(com.google.crypto.tink.proto.HashType hash)
                                         throws java.security.GeneralSecurityException
        Converts protobuf enum HashType to raw Java enum Enums.HashType.
        Throws:
        java.security.GeneralSecurityException - if the HashType is not SHA256, SHA384, or SHA512.
      • toCurveType

        public static EllipticCurves.CurveType toCurveType​(com.google.crypto.tink.proto.EllipticCurveType type)
                                                    throws java.security.GeneralSecurityException
        Converts protobuf enum EllipticCurveType to raw Java enum {code CurveType}.
        Throws:
        java.security.GeneralSecurityException
      • toEcdsaEncoding

        public static EllipticCurves.EcdsaEncoding toEcdsaEncoding​(com.google.crypto.tink.proto.EcdsaSignatureEncoding encoding)
                                                            throws java.security.GeneralSecurityException
        Converts protobuf enum EcdsaSignatureEncoding to raw Java enum {code EllipticCurves.EcdsaEncoding}.
        Throws:
        java.security.GeneralSecurityException
      • toUnsignedIntByteString

        public static com.google.protobuf.ByteString toUnsignedIntByteString​(java.math.BigInteger i)
        Returns the unsigned byte representation of the input BigInteger. BigInteger's toByteArray returns a two's complement representation of non-negative integers, which might include an extra zero byte at position 0 (in big endian).