All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.mmm.crypto.asymmetric.crypt.AsymmetricCryptorFactory Maven / Gradle / Ivy

package io.github.mmm.crypto.asymmetric.crypt;

import java.security.PrivateKey;
import java.security.PublicKey;

import io.github.mmm.crypto.crypt.CryptorFactory;
import io.github.mmm.crypto.crypt.Decryptor;
import io.github.mmm.crypto.crypt.Encryptor;

/**
 * Extends {@link CryptorFactory} for {@link io.github.mmm.crypto.asymmetric.key.AsymmetricKeyPair
 * asymmetric} encryption and decryption.
 *
 * @param  type of {@link PrivateKey}.
 * @param  type of {@link PublicKey}.
 * @author Joerg Hohwiller (hohwille at users.sourceforge.net)
 * @since 1.0.0
 */
public interface AsymmetricCryptorFactory extends CryptorFactory {

  /**
   * @param publicKey the {@link PublicKey} to use for encryption.
   * @return the {@link Encryptor} for encryption.
   */
  default Encryptor newEncryptor(PU publicKey) {

    return newEncryptorUnsafe(publicKey);
  }

  /**
   * @param privateKey the {@link PrivateKey} to use for decryption.
   * @return the {@link Decryptor} for decryption.
   */
  default Decryptor newDecryptor(PR privateKey) {

    return newDecryptorUnsafe(privateKey);
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy