Package org.apache.harmony.security.x509

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


     * 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

            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

            try {
                byte[] bytes = getExtensionValue(cert, "2.5.29.16"); //$NON-NLS-1$
                if (bytes == null) {
                    return false;
                }
                PrivateKeyUsagePeriod pkup = (PrivateKeyUsagePeriod)
                                    PrivateKeyUsagePeriod.ASN1.decode(bytes);
                Date notBefore = pkup.getNotBefore();
                Date notAfter = pkup.getNotAfter();
                if ((notBefore == null) && (notAfter == null)) {
                    return false;
                }
                if ((notBefore != null)
                    && notBefore.compareTo(privateKeyValid) > 0) {
View Full Code Here

    public void testEncodeDecode() throws Exception {

        Date notBeforeDate = new Date(200000000);
        Date notAfterDate = new Date(300000000);

        PrivateKeyUsagePeriod pkup = new PrivateKeyUsagePeriod(notBeforeDate,
                notAfterDate);

        byte[] encoded = pkup.getEncoded();

        pkup = (PrivateKeyUsagePeriod) PrivateKeyUsagePeriod.ASN1
                .decode(encoded);

        assertEquals("notBeforeDate", notBeforeDate, pkup.getNotBefore());
        assertEquals("notAfterDate", notAfterDate, pkup.getNotAfter());
    }
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

            try {
                byte[] bytes = getExtensionValue(cert, "2.5.29.16"); //$NON-NLS-1$
                if (bytes == null) {
                    return false;
                }
                PrivateKeyUsagePeriod pkup = (PrivateKeyUsagePeriod)
                                    PrivateKeyUsagePeriod.ASN1.decode(bytes);
                Date notBefore = pkup.getNotBefore();
                Date notAfter = pkup.getNotAfter();
                if ((notBefore == null) && (notAfter == null)) {
                    return false;
                }
                if ((notBefore != null)
                    && notBefore.compareTo(privateKeyValid) > 0) {
View Full Code Here

TOP

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

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.