|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object core.crypto.Signatures
public class Signatures
Provides easy access to all Signature stuff
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 |
HASH_ALGORITHM
|
Constructor Summary | |
---|---|
Signatures()
|
Method Summary | |
---|---|
static Set<String> |
getValidServices()
Creates a list of valid signature algorithms |
static boolean |
isValidSignatureAlgorithm(String algorithm)
|
static byte[] |
sign(byte[] tbs,
PrivateKey privatekey,
String sigAlgo)
Sign a byte array |
static void |
sign(File inputFile,
File sigFile,
KeyStore.PrivateKeyEntry entry)
Simply sign a File. |
static X509Certificate |
sign(X509Certificate userCert,
KeyStore.PrivateKeyEntry caEntry)
Signs the user cert with the CA's private key |
static void |
signXML(File inputFile,
File outputFile,
KeyStore.PrivateKeyEntry entry,
String sigAlgo)
Sign a files hash and create an XML-Signature |
static boolean |
verify(byte[] tbs,
PublicKey pubKey,
String sigAlg)
|
static boolean |
verify(File signedFile,
File sigFile,
X509Certificate cert)
Verifies a signature created by the simple verify. |
static boolean |
verify(X509Certificate cert)
|
static boolean |
verify(X509Certificate cert,
PublicKey pubKey)
|
static boolean |
verifyXML(File inputFile)
Read an XML-Signature, get the referenced file and compare the signed hashes and the signature |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String HASH_ALGORITHM
Constructor Detail |
---|
public Signatures()
Method Detail |
---|
public static void signXML(File inputFile, File outputFile, KeyStore.PrivateKeyEntry entry, String sigAlgo) throws IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidAlgorithmParameterException, InterruptedException, SignatureException
inputFile
- outputFile
- entry
-
IOException
NoSuchAlgorithmException
InvalidKeyException
InvalidAlgorithmParameterException
InterruptedException
SignatureException
http://www.w3.org/TR/xmldsig-core/
public static boolean verifyXML(File inputFile) throws Exception
inputFile
-
Exception
- TODO Hash-Algorithmus auslesen und verwendenhttp://www.w3.org/TR/xmldsig-core/
public static void sign(File inputFile, File sigFile, KeyStore.PrivateKeyEntry entry) throws Exception
inputFile
- sigFile
- entry
-
Exception
public static byte[] sign(byte[] tbs, PrivateKey privatekey, String sigAlgo) throws NoSuchAlgorithmException, SignatureException, InvalidKeyException
tbs
- privatekey
-
NoSuchAlgorithmException
SignatureException
InvalidKeyException
public static X509Certificate sign(X509Certificate userCert, KeyStore.PrivateKeyEntry caEntry) throws CertificateEncodingException, InvalidKeyException, NoSuchAlgorithmException, SignatureException
certificate
- caCert
-
CertificateEncodingException
SignatureException
NoSuchAlgorithmException
InvalidKeyException
public static boolean verify(File signedFile, File sigFile, X509Certificate cert) throws Exception
signedFile
- sigFile
- cert
-
Exception
public static boolean verify(byte[] tbs, PublicKey pubKey, String sigAlg) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException
NoSuchAlgorithmException
InvalidKeyException
SignatureException
public static boolean verify(X509Certificate cert, PublicKey pubKey) throws NoSuchAlgorithmException, InvalidKeyException, CertificateEncodingException, SignatureException
NoSuchAlgorithmException
InvalidKeyException
CertificateEncodingException
SignatureException
public static boolean verify(X509Certificate cert) throws NoSuchAlgorithmException, InvalidKeyException, CertificateEncodingException, SignatureException
NoSuchAlgorithmException
InvalidKeyException
CertificateEncodingException
SignatureException
public static boolean isValidSignatureAlgorithm(String algorithm) throws NoSuchAlgorithmException, InvalidKeyException
NoSuchAlgorithmException
InvalidKeyException
public static Set<String> getValidServices()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |