1 // Copyright 2017 Google Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 // 15 //////////////////////////////////////////////////////////////////////////////// 16 17 package com.google.crypto.tink; 18 19 import java.security.GeneralSecurityException; 20 21 /** 22 * Interface for public key signing. 23 * 24 * <p>Digital Signatures provide functionality of signing data and verification of the signatures. 25 * 26 * <h3>Security guarantees</h3> 27 * 28 * <p>The functionality of Digital Signatures is represented a pair of primitives (interfaces) 29 * {@link PublicKeySign} for signing of data, and {@link PublicKeyVerify} for verification of 30 * signatures. Implementations of these interfaces are secure against adaptive chosen-message 31 * attacks. Signing data ensures the authenticity and the integrity of that data, but not its 32 * secrecy. 33 * 34 * @since 1.0.0 35 */ 36 public interface PublicKeySign { 37 /** 38 * Computes the signature for {@code data}. 39 * 40 * @return the signature of {@code data} 41 */ sign(final byte[] data)42 byte[] sign(final byte[] data) throws GeneralSecurityException; 43 } 44