|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--demo.x509.X509
This class tests the implementation of creating and verifying certificates based on the X509 notation.
As signature algorithms serve MD5withRSA respectively dsaWithSHA.
Constructor Summary | |
X509()
|
Method Summary | |
X509Certificate |
createCertificate(Name subject,
PublicKey pk,
Name issuer,
PrivateKey sk,
AlgorithmID algorithm,
boolean extensions)
Creates a certificate according to the X.509 Notation. |
KeyPair |
generateKeyPair(String algorithm,
int bits)
Generates a Key Pair for the specified public-key algorithm. |
static void |
main(String[] arg)
Performs certificate creation and verification tests. |
void |
start()
Tests the certificate creation and verification process implementation for the MD5withRSA and DSA signature algorithms. |
void |
testDSACertificates()
Tests the certificate creation and verification process implemention using the dsaWithSHA signature algorithm. |
void |
testRSACertificates()
Tests the certificate creation and verification process implemention using the MD5withRSA signature algorithm. |
void |
verifyCertificate(X509Certificate userCert,
X509Certificate caCert)
Verifies a certificate. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public X509()
Method Detail |
public KeyPair generateKeyPair(String algorithm, int bits) throws Exception
algorithm
- the name of the public-key algorithmbits
- the length of the key (modulus) in bitspublic void verifyCertificate(X509Certificate userCert, X509Certificate caCert) throws Exception
userCert
- the certificate to be verifiedcaCert
- the certificate used for verifying the userCertpublic X509Certificate createCertificate(Name subject, PublicKey pk, Name issuer, PrivateKey sk, AlgorithmID algorithm, boolean extensions) throws Exception
Depending on the subject ID either a self-signed CA certificate will
be created or a user certificate. If the extensions
parameter
is set to true
, SubjectKeyIdentifier
, KeyUsage
,
and BasicConstraints
extensions will be added to the new certifcate.
subject
- the user demanding the certificate (may be the certification authority itself)pk
- the subjectīs public key to be certifiedissuer
- the certification authority that issues the certificatesk
- the issuerīs private key for signing the certificatealgorithm
- the ID of the signature algorithmextensions
- a boolean value indicating if there are any extending informationspublic void testRSACertificates() throws Exception
The method goes to the following steps:
public void testDSACertificates() throws Exception
The method goes to the following steps:
public void start()
public static void main(String[] arg) throws IOException
IOException
- if an I/O Error occurs
|
This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |