core.crypto
Class Hybrid

java.lang.Object
  extended by core.crypto.Hybrid

public class Hybrid
extends Object

This class provides easy acces to our hybrid encryption implementations.

  Copyright (c) 2006 Sebastian Erdweg
  Copyright (c) 2006 Dominik Schulz
  Copyright (c) 2006 Florian Lindner
  Copyright (c) 2006 Betim Berjani
  
  This file is part of FlexiCrypt.

  FlexiCrypt is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  FlexiCrypt is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.
  
  You should have received a copy of the GNU General Public License
  along with FlexiCrypt; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  

Author:
Dominik

Constructor Summary
Hybrid()
           
 
Method Summary
static void decryptBinarySimple(PrivateKey recieversKey, File ciphertext, File plaintext)
          Decrypts a single File in the simple binary format.
static void decryptXMLZIP(File ciphertext, File plaintext)
          Decrypts a file that was decrypted for some private key in our keystore.
static void decryptXMLZIP(PrivateKey privateKey, File ciphertext, File plaintext)
          This class is only meant for unit testing!!!
static void encryptBinarySimple(PublicKey recieversKey, File plaintext, File ciphertext, String symmetricAlgorithm, int symmStrength)
          Encrypts a single File for a single reciever in a simple binary format.
static void encryptXMLZIP(X509Certificate[] recieverCerts, File plaintext, File ciphertext, String symmetricAlgorithm, int symmStrength)
          Encrypts a single File for an unlimited* number of recievers.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Hybrid

public Hybrid()
Method Detail

encryptBinarySimple

public static void encryptBinarySimple(PublicKey recieversKey,
                                       File plaintext,
                                       File ciphertext,
                                       String symmetricAlgorithm,
                                       int symmStrength)
                                throws NoSuchAlgorithmException,
                                       NoSuchPaddingException,
                                       InvalidKeyException,
                                       IllegalBlockSizeException,
                                       BadPaddingException,
                                       IOException
Encrypts a single File for a single reciever in a simple binary format. This simple binary format basicly looks like this: FILE HEADER|SYMMETRIC ALGORITHM BLOCK HEADER|SYMMETRIC ALGORITHM BLOCK LENGTH|SYMMETRIC ALGORITHM NAME| SYMMETRIC KEY HEADER|SYMMETRIC KEY LENGTH|SYMMETRIC KEY|PAYLOAD

Parameters:
recieversKey - the you wan't to encrypt for
plaintext - the Plaintext, what you want to encrypt
ciphertext - the Ciphertext, where does the encrypted data go to
symmetricAlgorithm - the symmetric algorithm, depends on your security provider
symmStrength - the strength of your choosen symmetric algorithmen depends on both your algorithm and your security provider
Throws:
NoSuchAlgorithmException
NoSuchPaddingException
InvalidKeyException
IllegalBlockSizeException
BadPaddingException
IOException

decryptBinarySimple

public static void decryptBinarySimple(PrivateKey recieversKey,
                                       File ciphertext,
                                       File plaintext)
                                throws IOException,
                                       NoSuchAlgorithmException,
                                       NoSuchPaddingException,
                                       InvalidKeyException,
                                       IllegalBlockSizeException,
                                       BadPaddingException
Decrypts a single File in the simple binary format. This simple binary format basicly looks like this: FILE HEADER|SYMMETRIC ALGORITHM BLOCK HEADER|SYMMETRIC ALGORITHM BLOCK LENGTH|SYMMETRIC ALGORITHM NAME| SYMMETRIC KEY HEADER|SYMMETRIC KEY LENGTH|SYMMETRIC KEY|PAYLOAD

Parameters:
recieversKey - YOUR(?) Private Key to decrypt the symmetric key
ciphertext - where to load the data from
plaintext - where to write the decrypted data to
Throws:
IOException
NoSuchAlgorithmException
NoSuchPaddingException
InvalidKeyException
IllegalBlockSizeException
BadPaddingException

encryptXMLZIP

public static void encryptXMLZIP(X509Certificate[] recieverCerts,
                                 File plaintext,
                                 File ciphertext,
                                 String symmetricAlgorithm,
                                 int symmStrength)
                          throws NoSuchAlgorithmException,
                                 NoSuchPaddingException,
                                 InvalidKeyException,
                                 IOException,
                                 ParserConfigurationException,
                                 IllegalBlockSizeException,
                                 BadPaddingException,
                                 InvalidAlgorithmParameterException
Encrypts a single File for an unlimited* number of recievers. The data is encrypted and packed, together with additional information, in a zip-file. The symmetric algorithm, the asymmetric encrypted symmetric key and the information about the recievers public keys is written to an XML-file which is stored in the zip along with the payload.

Parameters:
recieverCerts -
plaintext -
ciphertext -
symmetricAlgorithm -
symmStrength -
Throws:
NoSuchAlgorithmException
NoSuchPaddingException
InvalidKeyException
IOException
ParserConfigurationException
IllegalBlockSizeException
BadPaddingException - * - some technical restrictions apply.
InvalidAlgorithmParameterException

decryptXMLZIP

public static void decryptXMLZIP(File ciphertext,
                                 File plaintext)
                          throws Exception
Decrypts a file that was decrypted for some private key in our keystore.

Parameters:
ciphertext -
plaintext -
Throws:
Exception

decryptXMLZIP

public static void decryptXMLZIP(PrivateKey privateKey,
                                 File ciphertext,
                                 File plaintext)
                          throws Exception
This class is only meant for unit testing!!!

Parameters:
privateKey -
ciphertext -
plaintext -
Throws:
Exception