|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object core.crypto.Asymmetric
public class Asymmetric
A static class providing all asymmetric cipher operations
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
Field Summary | |
---|---|
static String |
CERT_END_TAG
|
static String |
CERT_START_TAG
|
static String |
MODE_PADDING
|
Method Summary | |
---|---|
static byte[] |
decrypt(byte[] in,
PrivateKey privateKey,
int buffersize)
|
static void |
decrypt(File inputFile,
File outputFile,
PrivateKey privateKey,
int buffersize)
|
static void |
decrypt(InputStream fis,
OutputStream fos,
PrivateKey privateKey,
int buffersize)
|
static String |
decrypt(String in,
PrivateKey privateKey,
int buffersize)
|
static byte[] |
encrypt(byte[] in,
PublicKey publicKey,
int buffersize)
|
static void |
encrypt(File inputFile,
File outputFile,
PublicKey publicKey,
int buffersize)
|
static void |
encrypt(InputStream fis,
OutputStream fos,
PublicKey publicKey,
int buffersize)
|
static String |
encrypt(String in,
PublicKey publicKey,
int buffersize)
|
static KeyPair |
getNewKeyPair(String algorithm,
int keysize)
This Method generats a new KeyPair |
static KeyStore.PrivateKeyEntry |
getNewPrivateKeyEntry(String asymAlgo,
String signAlgo,
int keysize,
Calendar notBefore,
Calendar notAfter,
int usage,
boolean isUsageCritical,
int extendedUsage,
boolean isExtendedUsageCritical,
boolean isCA,
boolean isCACritical,
String commonName,
String country,
String email,
String locationCity,
String organization,
String organizationUnit)
erzeugt einen privatekeyentry unter angabe aller details |
static KeyStore.PrivateKeyEntry |
getNewPrivateKeyEntry(String asymAlgo,
String signAlgo,
int keysize,
Principal principal,
String email,
Calendar notBefore,
Calendar notAfter,
int usage,
boolean isUsageCritical,
int extendedUsage,
boolean isExtendedUsageCritical,
boolean isCA,
boolean isCACritical)
Constructs a private key entry with a self-signed cert. |
static KeyStore.PrivateKeyEntry |
getNewPrivateKeyEntry(String asymAlgo,
String signAlgo,
int keysize,
Principal principal,
String email,
Calendar notBefore,
Calendar notAfter,
int usage,
boolean isUsageCritical,
int extendedUsage,
boolean isExtendedUsageCritical,
boolean isCA,
boolean isCACritical,
PrivateKey signWith,
X509Certificate signersCert)
|
static HashMap<String,Set<Integer>> |
getValidServices()
Creates a set of valid asymmetric algorithms |
static boolean |
isValidKeySize(String algorithm,
int keysize)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String CERT_START_TAG
public static final String CERT_END_TAG
public static final String MODE_PADDING
Method Detail |
---|
public static byte[] encrypt(byte[] in, PublicKey publicKey, int buffersize) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, IOException, InterruptedException, IllegalBlockSizeException, BadPaddingException
in
- publicKey
- buffersize
-
InvalidKeyException
NoSuchAlgorithmException
NoSuchPaddingException
IOException
InterruptedException
BadPaddingException
IllegalBlockSizeException
public static String encrypt(String in, PublicKey publicKey, int buffersize) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, IOException, InterruptedException, IllegalBlockSizeException, BadPaddingException
in
- publicKey
- buffersize
-
InvalidKeyException
NoSuchAlgorithmException
NoSuchPaddingException
IOException
InterruptedException
BadPaddingException
IllegalBlockSizeException
public static void encrypt(File inputFile, File outputFile, PublicKey publicKey, int buffersize) throws FileNotFoundException, NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, IOException, InterruptedException, IllegalBlockSizeException, BadPaddingException
inputFile
- outputFile
- publicKey
- buffersize
-
FileNotFoundException
NoSuchPaddingException
NoSuchAlgorithmException
InvalidKeyException
IOException
InterruptedException
BadPaddingException
IllegalBlockSizeException
public static void encrypt(InputStream fis, OutputStream fos, PublicKey publicKey, int buffersize) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IOException, InterruptedException, IllegalBlockSizeException, BadPaddingException
fis
- fos
- publicKey
- buffersize
-
NoSuchAlgorithmException
NoSuchPaddingException
InvalidKeyException
IOException
InterruptedException
BadPaddingException
IllegalBlockSizeException
public static byte[] decrypt(byte[] in, PrivateKey privateKey, int buffersize) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, IOException, InterruptedException
in
- privateKey
- buffersize
-
InvalidKeyException
NoSuchAlgorithmException
NoSuchPaddingException
IOException
InterruptedException
public static String decrypt(String in, PrivateKey privateKey, int buffersize) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, IOException, InterruptedException
in
- privateKey
- buffersize
-
InvalidKeyException
NoSuchAlgorithmException
NoSuchPaddingException
IOException
InterruptedException
public static void decrypt(File inputFile, File outputFile, PrivateKey privateKey, int buffersize) throws FileNotFoundException, NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, IOException, InterruptedException
inputFile
- outputFile
- privateKey
- buffersize
-
FileNotFoundException
NoSuchPaddingException
NoSuchAlgorithmException
InvalidKeyException
IOException
InterruptedException
public static void decrypt(InputStream fis, OutputStream fos, PrivateKey privateKey, int buffersize) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IOException, InterruptedException
fis
- fos
- privateKey
- buffersize
-
NoSuchAlgorithmException
NoSuchPaddingException
InvalidKeyException
IOException
InterruptedException
public static KeyStore.PrivateKeyEntry getNewPrivateKeyEntry(String asymAlgo, String signAlgo, int keysize, Principal principal, String email, Calendar notBefore, Calendar notAfter, int usage, boolean isUsageCritical, int extendedUsage, boolean isExtendedUsageCritical, boolean isCA, boolean isCACritical) throws NoSuchAlgorithmException, Exception
asymAlgo
- keysize
- principal
- notBefore
- notAfter
- usage
-
NoSuchAlgorithmException
Exception
public static KeyStore.PrivateKeyEntry getNewPrivateKeyEntry(String asymAlgo, String signAlgo, int keysize, Principal principal, String email, Calendar notBefore, Calendar notAfter, int usage, boolean isUsageCritical, int extendedUsage, boolean isExtendedUsageCritical, boolean isCA, boolean isCACritical, PrivateKey signWith, X509Certificate signersCert) throws NoSuchAlgorithmException, Exception
NoSuchAlgorithmException
Exception
public static KeyStore.PrivateKeyEntry getNewPrivateKeyEntry(String asymAlgo, String signAlgo, int keysize, Calendar notBefore, Calendar notAfter, int usage, boolean isUsageCritical, int extendedUsage, boolean isExtendedUsageCritical, boolean isCA, boolean isCACritical, String commonName, String country, String email, String locationCity, String organization, String organizationUnit) throws NoSuchAlgorithmException, Exception
asymAlgo
- keysize
- notBefore
- notAfter
- usage
- commonName
- country
- email
- locationCity
- organization
- organizationUnit
-
NoSuchAlgorithmException
Exception
public static KeyPair getNewKeyPair(String algorithm, int keysize) throws NoSuchAlgorithmException
algorithm
- keysize
-
NoSuchAlgorithmException
public static boolean isValidKeySize(String algorithm, int keysize) throws NoSuchAlgorithmException
algorithm
- keysize
-
NoSuchAlgorithmException
- if this algorithm keysize combination is
not possiblepublic static HashMap<String,Set<Integer>> getValidServices()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |