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

org.beigesoft.ajetty.IHpCrypt Maven / Gradle / Ivy

/*
BSD 2-Clause License

Copyright (c) 2019, Beigesoft™
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
  list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
  this list of conditions and the following disclaimer in the documentation
  and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package org.beigesoft.ajetty;

import java.security.KeyStore;
import java.security.PublicKey;

/**
 * 

Service that loads/holds keystore, performs encryption/decryption. * This is for localhost only!

* @author Yury Demidenko */ public interface IHpCrypt { /** *

Calculate SHA1 for given bytes (public key).

* @param pPublicKey bytes * @return SHA1 bytes array * @throws Exception an Exception */ byte[] calcSha1(byte[] pPublicKey) throws Exception; /** *

Lazy load keystore * (for farther SSL trusted certificate initialization).

* @return Keystore * @throws Exception - an exception **/ KeyStore lazKeystore() throws Exception; /** *

Encrypts file.

* @param pFilePath File Path * @param pEncryptedPath Encrypted Path * @throws Exception - an exception **/ void encryptFile(String pFilePath, String pEncryptedPath) throws Exception; /** *

Decrypts file.

* @param pEncryptedPath Encrypted Path * @param pDecryptedPath Decrypted Path * @throws Exception - an exception **/ void decryptFile(String pEncryptedPath, String pDecryptedPath) throws Exception; /** *

Getter for ourPublicKey in lazy mode.

* @return our APK PublicKey * @throws Exception - an exception **/ PublicKey lazOurPublicKey() throws Exception; /** *

Lazy getter of public key of another A-Jetty.

* @return public key of another A-Jetty * @throws Exception - an exception **/ PublicKey lazPublicKeyAnotherAjetty() throws Exception; }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy