|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.ssonet.util.CryptoTools
Title: Cryptotools for SSONET Description: This class is a collection of helpfull Methods for handling cryptographic operations Copyright: Copyright (c) 2001 Company:
Field Summary | |
static boolean |
debug
|
Constructor Summary | |
CryptoTools()
|
Method Summary | |
static java.security.cert.X509Certificate |
createCertificate(java.security.PublicKey publicKey,
java.security.PrivateKey signKey,
java.security.cert.X509Certificate issuerCertificate,
java.util.Date notBefore,
java.util.Date notAfter,
java.lang.String subject)
Create a X509Certificate for a public key (only DSA-Certificates are allowed) |
static java.security.KeyPair |
createKeyPair(java.lang.String mechanismName,
int keyLength)
Create a keypair |
static java.lang.String |
getPrincipalElement(java.security.Principal p,
java.lang.String commonSymbol)
For X509Certificates: Get an element of the Name from IssuerDN or SubjectDN |
static java.security.SecureRandom |
getSecureRandom()
Initializes the secureRandom object. |
static java.security.cert.X509Certificate |
readCertificate(java.lang.String certificateFileName)
reads a certificate from file |
static java.security.PrivateKey |
readPrivateKeyPKCS8(java.lang.String privateKeyFileName,
java.lang.String algName)
reads a DER encoded private key from file |
static java.security.PublicKey |
readPublicKeyX509(java.lang.String publicKeyFileName,
java.lang.String algName)
reads a DER encoded public key from file |
static void |
testCertificate(java.security.cert.X509Certificate toTest,
java.security.PublicKey publicKey)
checks, whether a certificate is valid. |
static void |
writeCertificate(java.security.cert.X509Certificate certificate,
java.lang.String fileName)
Writes a X509 certificate to a file |
static void |
writePrivateKeyPKCS8(java.security.PrivateKey privateKey,
java.lang.String fileName)
Writes a Private Key to a file in PKCS8 encoding. |
static void |
writePublicKeyX509(java.security.PublicKey publicKey,
java.lang.String fileName)
Writes a Public Key to a file in X509 encoding. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static boolean debug
Constructor Detail |
public CryptoTools()
Method Detail |
public static java.security.SecureRandom getSecureRandom()
public static java.security.KeyPair createKeyPair(java.lang.String mechanismName, int keyLength)
public static java.security.cert.X509Certificate createCertificate(java.security.PublicKey publicKey, java.security.PrivateKey signKey, java.security.cert.X509Certificate issuerCertificate, java.util.Date notBefore, java.util.Date notAfter, java.lang.String subject) throws java.lang.Exception
duration
- Gültigkeitszeitraum in Tagensubject
- Distinguished Name of the subject of this certificatepublic static void testCertificate(java.security.cert.X509Certificate toTest, java.security.PublicKey publicKey) throws java.security.cert.CertificateException, java.security.NoSuchAlgorithmException, java.security.InvalidKeyException, java.security.SignatureException
toTest
- certificate to testpublicKey
- certificate issuers public keyCertificateException,
- if the certificate is not validpublic static java.security.cert.X509Certificate readCertificate(java.lang.String certificateFileName)
certificateFileName
- certificate file namepublic static void writeCertificate(java.security.cert.X509Certificate certificate, java.lang.String fileName) throws java.lang.Exception
certificate
- the certificatefileName
- the filename of the file the certificate shall be written tojava.lang.Exception
- if an error occures while writing the certificatepublic static java.security.PrivateKey readPrivateKeyPKCS8(java.lang.String privateKeyFileName, java.lang.String algName)
privateKeyFileName
- private key file namepublic static void writePrivateKeyPKCS8(java.security.PrivateKey privateKey, java.lang.String fileName) throws java.lang.Exception
privateKey
- the private keyfileName
- the filename of the file the key shall be written tojava.lang.Exception
- if the encoding is not PKCS8, and if an error occures during writingpublic static java.security.PublicKey readPublicKeyX509(java.lang.String publicKeyFileName, java.lang.String algName)
publicKeyFileName
- public key file namepublic static void writePublicKeyX509(java.security.PublicKey publicKey, java.lang.String fileName) throws java.lang.Exception
publicKey
- the public keyfileName
- the filename of the file the key shall be written tojava.lang.Exception
- if the encoding is not X509, and if an error occures during writingpublic static java.lang.String getPrincipalElement(java.security.Principal p, java.lang.String commonSymbol)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |