Package org.apache.harmony.security.x509

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


     * setSubjectAlternativeNames(Collection<List<?>> names) method testing.
     */
    public void testSetSubjectAlternativeNames() {
        try {
            GeneralName san0 =
                new GeneralName(new OtherName("1.2.3.4.5",
                            new byte[] {1, 2, 0, 1}));
            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"));
View Full Code Here


     * addSubjectAlternativeName(int type, byte[] name) method testing.
     */
    public void testAddSubjectAlternativeName2() {
        try {
            GeneralName san0 =
                new GeneralName(new OtherName("1.2.3.4.5",
                        ASN1Integer.getInstance().encode(
                                BigInteger.valueOf(55L).toByteArray())
                            ));
            GeneralName san1 = new GeneralName(1, "rfc@822.Name");
            GeneralName san2 = new GeneralName(2, "dNSName");
View Full Code Here

public class GeneralNameTest extends TestCase {

    public void testGeneralName() {
        try {
            GeneralName san0 =
                new GeneralName(new OtherName("1.2.3.4.5", new byte[] {1, 2, 0, 1}));
            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 =
View Full Code Here

        }
    }

    public void testGeneralName1() {
        try {
            OtherName on =
                new OtherName("1.2.3.4.5", new byte[] {1, 2, 0, 1});
            byte[] encoding = OtherName.ASN1.encode(on);
            new GeneralName(0, encoding);
            OtherName.ASN1.decode(encoding);
            GeneralName gn = new GeneralName(on);
            new GeneralName(0, gn.getEncodedName());
View Full Code Here

                "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)
View Full Code Here

                                                    && (policies.length > 0)) {
                //  Certificate Policies Extension (as specified in rfc 3280)
                CertificatePolicies certificatePolicies =
                                                new CertificatePolicies();
                for (int i=0; i<policies.length; i++) {
                    PolicyInformation policyInformation =
                                            new PolicyInformation(policies[i]);
                    certificatePolicies.addPolicyInformation(policyInformation);
                }
                return ASN1OctetString.getInstance().encode(
                            certificatePolicies.getEncoded());
            }
View Full Code Here

            if (("2.5.29.14".equals(oid)) || ("2.5.29.35".equals(oid))) {
                // Extension value is represented as an OctetString
                return ASN1OctetString.getInstance().encode(keyIdentifier);
            }
            if ("2.5.29.16".equals(oid)) {
                PrivateKeyUsagePeriod pkup =
                                new PrivateKeyUsagePeriod(notBefore, notAfter);
                byte[] encoded = pkup.getEncoded();
                return ASN1OctetString.getInstance().encode(encoded);
            }
            if (("2.5.29.37".equals(oid)) && (extKeyUsage != null)) {
                ASN1Oid[] oa = new ASN1Oid[extKeyUsage.size()];
                String[] val = new String[extKeyUsage.size()];
View Full Code Here

        Name issuer = new Name(issuerName);
        Name subject = new Name(subjectName);
        Validity validity =
            new Validity(new Date(notBefore), new Date(notAfter));

        SubjectPublicKeyInfo subjectPublicKeyInfo = (SubjectPublicKeyInfo)
            SubjectPublicKeyInfo.ASN1.decode(publicKey.getEncoded());
        keyEncoding = subjectPublicKeyInfo.getEncoded();

        Extensions exts = new Extensions(Arrays.asList(extensions));
      
        TBSCertificate tbsCertificate =
            new TBSCertificate(version, serialNumber,
View Full Code Here

        BigInteger serialNumber = BigInteger.valueOf(555L);
        AlgorithmIdentifier signature = new AlgorithmIdentifier("1.2.3.44.555");
        Name issuer = new Name("O=Certificate Issuer");
        Validity validity = new Validity(new Date(100000000),
                                         new Date(200000000));
        SubjectPublicKeyInfo subjectPublicKeyInfo =
            new SubjectPublicKeyInfo(
                    new AlgorithmIdentifier("1.2.840.113549.1.1.2"),
                                            new byte[10]);
        boolean[] issuerUniqueID  = new boolean[]
                    {true, false, true, false, true, false, true, false};
        boolean[] subjectUniqueID = new boolean[]
View Full Code Here

                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]),
                    null, null, null),
                signature, new byte[10]));
            assertNull("Certificate should not be presented in CRL "
                    + "because issuer is not the same as CRL issuer",
                    crl.getRevokedCertificate(cert1));
View Full Code Here

TOP

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

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.