Package org.apache.harmony.security.x509

Examples of org.apache.harmony.security.x509.TBSCertList


     * all functionality will be tested.
     * @return
     * @throws java.lang.Exception
     */
    protected void setUp() throws java.lang.Exception {
        AlgorithmIdentifier signature =
            new AlgorithmIdentifier(algOID, algParams);
        Name issuer = new Name(issuerName);
        Name subject = new Name(subjectName);
        Validity validity =
            new Validity(new Date(notBefore), new Date(notAfter));

View Full Code Here


            signatureValue[20]++;
        } else {
            signatureValue = signatureValueBytes;
        }
       
        Certificate cert =
            new Certificate(tbsCertificate, signature, signatureValue);

        certEncoding = cert.getEncoded();

        cert = (Certificate) Certificate.ASN1.decode(certEncoding);
        certificate = new X509CertImpl(cert);
    }
View Full Code Here

     * getRevokedCertificate(X509Certificate certificate) method testing.
     */
    public void testGetRevokedCertificate1() {
        try {
            X509CertImpl cert1 = new X509CertImpl(
                new Certificate(
                    new TBSCertificate(2, certSerialNumber1, signature,
                        new Name(certIssuerName),
                        new Validity(new Date(), new Date()),
                    new Name(certIssuerName),
                    new SubjectPublicKeyInfo(signature, new byte[10]),
                    null, null, null),
                signature, new byte[10]));
            X509CertImpl cert2 = new X509CertImpl(
                new Certificate(
                    new TBSCertificate(2, certSerialNumber2, signature,
                        new Name(certIssuerName),
                        new Validity(new Date(), new Date()),
                    new Name(certIssuerName),
                    new SubjectPublicKeyInfo(signature, new byte[10]),
                    null, null, null),
                signature, new byte[10]));
            X509CertImpl cert3 = new X509CertImpl(
                new Certificate(
                    new TBSCertificate(2, certSerialNumber3, signature,
                        new Name("O=Another Cert Issuer"),
                        new Validity(new Date(), new Date()),
                    new Name(certIssuerName),
                    new SubjectPublicKeyInfo(signature, new byte[10]),
View Full Code Here

     * isRevoked(Certificate cert) method testing.
     */
    public void testIsRevoked() {
        try {
            X509CertImpl cert1 = new X509CertImpl(
                new Certificate(
                    new TBSCertificate(2, certSerialNumber1, signature,
                        new Name(certIssuerName),
                        new Validity(new Date(), new Date()),
                    new Name(certIssuerName),
                    new SubjectPublicKeyInfo(signature, new byte[10]),
                    null, null, null),
                signature, new byte[10]));
            X509CertImpl cert2 = new X509CertImpl(
                new Certificate(
                    new TBSCertificate(2, certSerialNumber2, signature,
                        new Name(certIssuerName),
                        new Validity(new Date(), new Date()),
                    new Name(certIssuerName),
                    new SubjectPublicKeyInfo(signature, new byte[10]),
                    null, null, null),
                signature, new byte[10]));
            X509CertImpl cert3 = new X509CertImpl(
                new Certificate(
                    new TBSCertificate(2, certSerialNumber3, signature,
                        new Name("O=Another Cert Issuer"),
                        new Validity(new Date(), new Date()),
                    new Name(certIssuerName),
                    new SubjectPublicKeyInfo(signature, new byte[10]),
View Full Code Here

            signatureValue[20]++;
        } else {
            signatureValue = signatureValueBytes;
        }
        certificateList =
            new CertificateList(tbscertlist, signature, signatureValue);

        encoding = CertificateList.ASN1.encode(certificateList);
        stream = new ByteArrayInputStream(encoding);

        crl = new X509CRLImpl(certificateList);
View Full Code Here

            String[] policies = new String[] {
                "0.0.0.0.0.0",
                "1.1.1.1.1.1",
                "2.2.2.2.2.2"
            };
            CertificatePolicies certificatePolicies =
                                            new CertificatePolicies();
            for (int i=0; i<policies.length; i++) {
                PolicyInformation policyInformation =
                                        new PolicyInformation(policies[i]);
                certificatePolicies.addPolicyInformation(policyInformation);
            }

            byte[] encoding = certificatePolicies.getEncoded();
            List policyInformations = ((CertificatePolicies)
                    CertificatePolicies.ASN1.decode(encoding))
                    .getPolicyInformations();
            Iterator it = policyInformations.iterator();
            ((PolicyInformation) it.next()).getPolicyIdentifier();
View Full Code Here

            GeneralName san1 = new GeneralName(1, "rfc@822.Name");
            GeneralName san2 = new GeneralName(2, "dNSName");
            GeneralName san3 = new GeneralName(new ORAddress());
            GeneralName san4 = new GeneralName(new Name("O=Organization"));
            GeneralName san5 =
                new GeneralName(new EDIPartyName("assigner", "party"));
            GeneralName san6 = new GeneralName(6, "http://uniform.Resource.Id");
            GeneralName san7 = new GeneralName(new byte[] {1, 1, 1, 1});
            GeneralName san8 = new GeneralName(8, "1.2.3.4444.55555");

            GeneralNames sans_1 = new GeneralNames();
View Full Code Here

            GeneralName san1 = new GeneralName(1, "rfc@822.Name");
            GeneralName san2 = new GeneralName(2, "dNSName");
            GeneralName san3 = new GeneralName(new ORAddress());
            GeneralName san4 = new GeneralName(new Name("O=Organization"));
            GeneralName san5 =
                new GeneralName(new EDIPartyName("assigner", "party"));
            GeneralName san6 = new GeneralName(6, "http://uniform.Resource.Id");
            GeneralName san7 = new GeneralName(7, "1.1.1.1");
            GeneralName san8 = new GeneralName(8, "1.2.3.4444.55555");

            GeneralNames sans_1 = new GeneralNames();
View Full Code Here

     * EDIPartyName(String nameAssigner, String partyName) method testing.
     */
    public void _testEDIPartyName1() {
        boolean pass = true;
        try {
            EDIPartyName ediPN = new EDIPartyName("nameAssigner", "partyName");
            byte[] encoded = ediPN.getEncoded();
            // manually derived data:
            byte[] _encoded = {
                (byte) 0x30, (byte) 0x1d, (byte) 0x80, (byte) 0x0e,
                (byte) 0x13, (byte) 0x0c, (byte) 0x6e, (byte) 0x61,
                (byte) 0x6d, (byte) 0x65, (byte) 0x41, (byte) 0x73,
View Full Code Here

    /**
     * EDIPartyName(String nameAssigner, String partyName, byte[] encoding)
     * method testing.
     */
    public void testEDIPartyName2() throws Exception {
        EDIPartyName ediName = new EDIPartyName("assigner", "party");
        byte[] encoding = EDIPartyName.ASN1.encode(ediName);
        EDIPartyName.ASN1.decode(encoding);
        new GeneralName(5, encoding);

        GeneralName gn = new GeneralName(ediName);
View Full Code Here

TOP

Related Classes of org.apache.harmony.security.x509.TBSCertList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.