Package org.apache.geronimo.crypto.asn1

Examples of org.apache.geronimo.crypto.asn1.DERGeneralString


       
        PKCS10CertificationRequest pkcs10certreq = new PKCS10CertificationRequest(data);
        if(!pkcs10certreq.verify()) {
            throw new Exception("CSR verification failed.");
        }
        CertificationRequestInfo certReqInfo = pkcs10certreq.getCertificationRequestInfo();
        Map map = new HashMap();
        map.put(CERT_REQ_SUBJECT, certReqInfo.getSubject());
        map.put(CERT_REQ_PUBLICKEY, certReqInfo.getSubjectPublicKeyInfo());
        map.put(CERT_REQ_PUBLICKEY_OBJ, getPublicKeyObject(certReqInfo.getSubjectPublicKeyInfo()));
        map.put(CERT_REQ_VERSION, certReqInfo.getVersion());
        return map;
    }
View Full Code Here


       
        PKCS10CertificationRequest pkcs10certreq = new PKCS10CertificationRequest(data);
        if(!pkcs10certreq.verify()) {
            throw new Exception("CSR verification failed.");
        }
        CertificationRequestInfo certReqInfo = pkcs10certreq.getCertificationRequestInfo();
        Map map = new HashMap();
        map.put(CERT_REQ_SUBJECT, certReqInfo.getSubject());
        map.put(CERT_REQ_PUBLICKEY, certReqInfo.getSubjectPublicKeyInfo());
        map.put(CERT_REQ_PUBLICKEY_OBJ, getPublicKeyObject(certReqInfo.getSubjectPublicKeyInfo()));
        map.put(CERT_REQ_VERSION, certReqInfo.getVersion());
        return map;
    }
View Full Code Here

       
        PKCS10CertificationRequest pkcs10certreq = new PKCS10CertificationRequest(data);
        if(!pkcs10certreq.verify()) {
            throw new Exception("CSR verification failed.");
        }
        CertificationRequestInfo certReqInfo = pkcs10certreq.getCertificationRequestInfo();
        Map map = new HashMap();
        map.put(CERT_REQ_SUBJECT, certReqInfo.getSubject());
        map.put(CERT_REQ_PUBLICKEY, certReqInfo.getSubjectPublicKeyInfo());
        map.put(CERT_REQ_PUBLICKEY_OBJ, getPublicKeyObject(certReqInfo.getSubjectPublicKeyInfo()));
        map.put(CERT_REQ_VERSION, certReqInfo.getVersion());
        return map;
    }
View Full Code Here

       
        PKCS10CertificationRequest pkcs10certreq = new PKCS10CertificationRequest(data);
        if(!pkcs10certreq.verify()) {
            throw new Exception("CSR verification failed.");
        }
        CertificationRequestInfo certReqInfo = pkcs10certreq.getCertificationRequestInfo();
        Map map = new HashMap();
        map.put(CERT_REQ_SUBJECT, certReqInfo.getSubject());
        map.put(CERT_REQ_PUBLICKEY, certReqInfo.getSubjectPublicKeyInfo());
        map.put(CERT_REQ_PUBLICKEY_OBJ, getPublicKeyObject(certReqInfo.getSubjectPublicKeyInfo()));
        map.put(CERT_REQ_VERSION, certReqInfo.getVersion());
        return map;
    }
View Full Code Here

     */
    public byte[] getEncoded()
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        DEROutputStream         dOut = new DEROutputStream(bOut);
        PrivateKeyInfo          info = new PrivateKeyInfo(new AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, new DERNull()), new RSAPrivateKeyStructure(getModulus(), getPublicExponent(), getPrivateExponent(), getPrimeP(), getPrimeQ(), getPrimeExponentP(), getPrimeExponentQ(), getCrtCoefficient()).getDERObject());

        try
        {
            dOut.writeObject(info);
            dOut.close();
View Full Code Here

     * construct an RSA key from a private key info object.
     */
    JCERSAPrivateCrtKey(
        PrivateKeyInfo  info)
    {
        this(new RSAPrivateKeyStructure((ASN1Sequence)info.getPrivateKey()));
    }
View Full Code Here

     */
    public byte[] getEncoded()
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        DEROutputStream         dOut = new DEROutputStream(bOut);
        PrivateKeyInfo          info = new PrivateKeyInfo(new AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, new DERNull()), new RSAPrivateKeyStructure(getModulus(), getPublicExponent(), getPrivateExponent(), getPrimeP(), getPrimeQ(), getPrimeExponentP(), getPrimeExponentQ(), getCrtCoefficient()).getDERObject());

        try
        {
            dOut.writeObject(info);
            dOut.close();
View Full Code Here

                  obj = ASN1TaggedObject.getInstance(obj).getObject();
                }
                ASN1Sequence krb5Seq = ASN1Sequence.getInstance(obj);
                // Get the Realm tagged as 0
                ASN1TaggedObject robj = (ASN1TaggedObject) krb5Seq.getObjectAt(0);
                DERGeneralString realmObj = DERGeneralString.getInstance(robj.getObject());
                String realm = realmObj.getString();
                // Get the PrincipalName tagged as 1
                ASN1TaggedObject pobj = (ASN1TaggedObject) krb5Seq.getObjectAt(1);
                // This is another sequence of type and name
                ASN1Sequence nseq = ASN1Sequence.getInstance(pobj.getObject());
                // Get the name tagged as 1
                ASN1TaggedObject nobj = (ASN1TaggedObject) nseq.getObjectAt(1);
                // The name is yet another sequence of GeneralString
                ASN1Sequence sseq = ASN1Sequence.getInstance(nobj.getObject());
                Enumeration<ASN1Object> en = sseq.getObjects();
                while (en.hasMoreElements()) {
                  ASN1Object o = (ASN1Object)en.nextElement();
                    DERGeneralString str = DERGeneralString.getInstance(o);
                    if (ret != null) {
                      ret += "/"+str.getString();
                    } else {
                        ret = str.getString()
                    }
                }
                // Add the realm in the end so we have "principal@realm"
                ret += "@"+realm;
            }
View Full Code Here

                v.add(new DERObjectIdentifier(CertTools.KRB5PRINCIPAL_OBJECTID));

                // First the Krb5PrincipalName sequence
                ASN1EncodableVector krb5p = new ASN1EncodableVector();
                // The realm is the first tagged GeneralString
                krb5p.add(new DERTaggedObject(true, 0, new DERGeneralString(realm)));
                // Second is the sequence of principal names, which is at tagged position 1 in the krb5p
                ASN1EncodableVector principals = new ASN1EncodableVector();
                // According to rfc4210 the type NT-UNKNOWN is 0, and according to some other rfc this type should be used...
                principals.add(new DERTaggedObject(true, 0, new DERInteger(0)));
                // The names themselves are yet another sequence
                Iterator<String> i = principalarr.iterator();
                ASN1EncodableVector names = new ASN1EncodableVector();
                while (i.hasNext()) {
                    String principalName = (String)i.next();
                    names.add(new DERGeneralString(principalName));
                }
                principals.add(new DERTaggedObject(true, 1, new DERSequence(names)));                 
                krb5p.add(new DERTaggedObject(true, 1, new DERSequence(principals)));
               
                v.add(new DERTaggedObject(true, 0, new DERSequence(krb5p)));
View Full Code Here

                new DERBMPString("hello world"),
                new DERBoolean(true),
                new DERBoolean(false),
                new DEREnumerated(100),
                new DERGeneralizedTime(new Date()),
                new DERGeneralString("hello world"),
                new DERIA5String("hello"),
                new DERInteger(1000),
                new DERNull(),
                new DERNumericString("123456"),
                new DERObjectIdentifier("1.1.1.10000.1"),
View Full Code Here

TOP

Related Classes of org.apache.geronimo.crypto.asn1.DERGeneralString

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.