Package codec.x501

Examples of codec.x501.Name


        X509CertSelector selector = new X509CertSelector();
        String subject = "O=Organization";
        X500Principal x500Subject = new X500Principal(subject);
        try {
            Name nameSubject = new Name(subject);
            for (int i=0; i<name_constraints.length; i++) {
                // make the subtrees (part of name constraints)
                // this subtrees will be used as permited and as excluded
                GeneralSubtree subtree =
                    new GeneralSubtree(name_constraints[i]);
View Full Code Here


        X509CertSelector selector = new X509CertSelector();
        String subject = "O=Organization";
        X500Principal x500Subject = new X500Principal(subject);
        try {
            Name nameSubject = new Name(subject);
            for (int i=0; i<name_constraints.length; i++) {
                // make the subtrees (part of name constraints)
                // this subtrees will be used as permited and as excluded
                GeneralSubtree subtree =
                    new GeneralSubtree(name_constraints[i]);
View Full Code Here

        X509CertSelector selector = new X509CertSelector();
        try {
            for (int i=0; i<variants.length; i++) {
                // make the names objects
                X500Principal subject = new X500Principal(variants[i][0]);
                Name subject_name = new Name(variants[i][0]);
                GeneralName alt_name = new GeneralName(4, variants[i][1]);
                // make the certificate to be checked
                GeneralNames alt_names_extension = new GeneralNames();
                alt_names_extension.addName(alt_name);
                TestCert certificate = new TestCert(alt_names_extension);
View Full Code Here

                                                        throws IOException {
        // make the TBSCertificate for Certificate
        int version = 2; //v3
        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"),
View Full Code Here

                break;
            case REG_ID:
                this.name = oidStrToInts(name);
                break;
            case DIR_NAME :
                this.name = new Name(name);
                break;
            case IP_ADDR :
                this.name = ipStrToBytes(name);
                break;
            default:
View Full Code Here

                break;
            case REG_ID:
                this.name = oidStrToInts(name);
                break;
            case DIR_NAME :
                this.name = new Name(name);
                break;
            case IP_ADDR :
                this.name = ipStrToBytes(name);
                break;
            default:
View Full Code Here

     * encoded form.
     *
     */
    public void testCertificationRequestInfo() throws IOException {
        int version = 2;// X.509 v3
        Name subject = new Name("O=subject");
        SubjectPublicKeyInfo spki = new SubjectPublicKeyInfo(
                new AlgorithmIdentifier("1.2.840.113549.1.1.2"), new byte[4]);
        List attributes = new ArrayList();
        // 1.2.840.113549.1.9.1 is OID of EMAILADDRESS
        attributes.add(new AttributeTypeAndValue("1.2.840.113549.1.9.1",
                new AttributeValue("a@b.com", false)));

        CertificationRequestInfo certReqInfo = new CertificationRequestInfo(
                version, subject, spki, attributes);

        // check what we have constructed
        assertEquals(version, certReqInfo.getVersion());
        assertEquals(subject.getName(X500Principal.RFC1779), certReqInfo
                .getSubject().getName(X500Principal.RFC1779));
        assertTrue(Arrays.equals(spki.getEncoded(), certReqInfo
                .getSubjectPublicKeyInfo().getEncoded()));
        assertEquals(attributes, certReqInfo.getAttributes());

View Full Code Here

     * encoded form.
     *
     */
    public void testCertificationRequest() throws IOException {
        int version = 2;// v3
        Name subject = new Name("O=subject");
        SubjectPublicKeyInfo spki = new SubjectPublicKeyInfo(
                new AlgorithmIdentifier("1.2.840.113549.1.1.2"), new byte[4]);
        List attributes = new ArrayList();
        // 1.2.840.113549.1.9.1 is OID of EMAILADDRESS
        attributes.add(new AttributeTypeAndValue("1.2.840.113549.1.9.1",
View Full Code Here

     * @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));

        SubjectPublicKeyInfo subjectPublicKeyInfo = (SubjectPublicKeyInfo)
            SubjectPublicKeyInfo.ASN1.decode(publicKey.getEncoded());
View Full Code Here

    public void testCertificate() throws Exception {
        // make the TBSCertificate for Certificate
        int version = 2; //v3
        BigInteger serialNumber = BigInteger.valueOf(555L);
        AlgorithmIdentifier signature = new AlgorithmIdentifier("1.2.3.44.555"); // random value
        Name issuer = new Name("O=Certificate Issuer");
        Validity validity = new Validity(new Date(100000000), new Date(200000000));
        Name subject = new Name("O=Subject Organization");
        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}; // random value
View Full Code Here

TOP

Related Classes of codec.x501.Name

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.