Package org.apache.harmony.security.x501

Examples of org.apache.harmony.security.x501.Attributes


        }
        issuerNames = new ArrayList<String>(names.size());
        for (Object name: names) {
            if (name instanceof String) {
                issuerNames.add(
                        new Name((String) name).getName(
                            X500Principal.CANONICAL));
            } else if (name instanceof byte[]) {
                issuerNames.add(
                        new Name((byte[]) name).getName(
                            X500Principal.CANONICAL));
            } else {
                throw new IOException(
                        Messages.getString("security.62")); //$NON-NLS-1$
            }
View Full Code Here


        if (iss_name == null) {
            iss_name = ""; //$NON-NLS-1$
        }

        String name = new Name(iss_name).getName(X500Principal.CANONICAL);
        if (!issuerNames.contains(name)) {
            issuerNames.add(name);
        }
    }
View Full Code Here

            throw new NullPointerException(Messages.getString("security.63")); //$NON-NLS-1$
        }
        if (issuerNames == null) {
            issuerNames = new ArrayList<String>();
        }
        String name = new Name(iss_name).getName(X500Principal.CANONICAL);
        if (!issuerNames.contains(name)) {
            issuerNames.add(name);
        }
    }
View Full Code Here

        super();
        if (name == null) {
            throw new NullPointerException(Messages.getString("auth.00")); //$NON-NLS-1$
        }
        try {
            dn = new Name(name);
        } catch (IOException e) {
            IllegalArgumentException iae = new IllegalArgumentException(Messages
                    .getString("auth.2D")); //$NON-NLS-1$
            iae.initCause(e);
            throw iae;
View Full Code Here

            throw new NoSuchAlgorithmException(
                    "Cannot find the algorithm to recover the key. ", e);
        }
        PublicKey publicKey = cert.getPublicKey();

        Name distinguishedName;
        try {
            distinguishedName = new Name(cert.getSubjectDN().getName());
        } catch (IOException e) {
            throw (IOException) new IOException(
                    "Failed to generate a distinguished name. ").initCause(e);
        }
View Full Code Here

        String sigAlgOID = sigAlgNameAndOID[1];

        AlgorithmIdentifier algId = new AlgorithmIdentifier(sigAlgOID);

        // generate a distinguished name using the string
        Name subjectDName = null;
        Name issuerDName = null;
        try {
            subjectDName = new Name(strSubjectDN);

            if (strSubjectDN.equals(strIssuerDN)) {
                issuerDName = subjectDName;
            } else {
                issuerDName = new Name(strIssuerDN);
            }
        } catch (IOException e) {
            throw (IOException) new IOException(
                    "Failed to generate a distinguished name. ").initCause(e);
        }
View Full Code Here

            throw new NoSuchAlgorithmException(
                    "Cannot find the algorithm to recover the key. ", e);
        }
        PublicKey publicKey = cert.getPublicKey();

        Name distinguishedName;
        try {
            distinguishedName = new Name(cert.getSubjectDN().getName());
        } catch (IOException e) {
            throw (IOException) new IOException(
                    "Failed to generate a distinguished name. ").initCause(e);
        }
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

     * @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 org.apache.harmony.security.x501.Attributes

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.