Class ProtoConversions


  • public final class ProtoConversions
    extends java.lang.Object
    This class provides conversions to Tink classes and enums which are in the public API to classes and enums generated by the Protobuf compiler.

    As a long term goal of Tink, we do not want to have code which the Protobuf compiler generates in the public API. Such code is more difficult to use externally to Google, for example with Maven. However, at least for some time we still will need to use these classes within Tink, hence we use such conversion code which must not be used outside of Tink as it may be removed at any time.

    • Method Detail

      • toProto

        public static com.google.crypto.tink.proto.KeyData.KeyMaterialType toProto​(ProtoKeySerialization.KeyMaterialType type)
                                                                            throws java.security.GeneralSecurityException
        Throws:
        java.security.GeneralSecurityException
      • fromProto

        public static ProtoKeySerialization.KeyMaterialType fromProto​(com.google.crypto.tink.proto.KeyData.KeyMaterialType type)
                                                               throws java.security.GeneralSecurityException
        Throws:
        java.security.GeneralSecurityException
      • fromProto

        public static ProtoKeySerialization.OutputPrefixType fromProto​(com.google.crypto.tink.proto.OutputPrefixType type)
                                                                throws java.security.GeneralSecurityException
        Throws:
        java.security.GeneralSecurityException
      • toProto

        public static com.google.crypto.tink.proto.OutputPrefixType toProto​(ProtoKeySerialization.OutputPrefixType type)
                                                                     throws java.security.GeneralSecurityException
        Throws:
        java.security.GeneralSecurityException
      • getOutputPrefix

        public static Bytes getOutputPrefix​(ProtoKeySerialization.OutputPrefixType type,
                                            @Nullable
                                            java.lang.Integer idRequirement)
                                     throws java.security.GeneralSecurityException
        Returns the output prefix using the standard technique for protobuf based keys. Typically, this should only be needed for legacy protobuf based keys.
        Throws:
        java.security.GeneralSecurityException