Examples of RSAPublicKeyStructure


Examples of org.bouncycastle.asn1.x509.RSAPublicKeyStructure

    {
        ByteArrayInputStream bAIS = new ByteArrayInputStream(readBytes(endMarker));
        ASN1InputStream ais = new ASN1InputStream(bAIS);
        Object asnObject = ais.readObject();
        ASN1Sequence sequence = (ASN1Sequence) asnObject;
        RSAPublicKeyStructure rsaPubStructure = new RSAPublicKeyStructure(sequence);
        RSAPublicKeySpec keySpec = new RSAPublicKeySpec(
                    rsaPubStructure.getModulus(),
                    rsaPubStructure.getPublicExponent());

        try
        {
            KeyFactory keyFact = KeyFactory.getInstance("RSA", provider);
View Full Code Here

Examples of org.bouncycastle.asn1.x509.RSAPublicKeyStructure

        AlgorithmIdentifier     algId = keyInfo.getAlgorithmId();
       
        if (algId.getObjectId().equals(PKCSObjectIdentifiers.rsaEncryption)
            || algId.getObjectId().equals(X509ObjectIdentifiers.id_ea_rsa))
        {
            RSAPublicKeyStructure   pubKey = new RSAPublicKeyStructure((ASN1Sequence)keyInfo.getPublicKey());

            return new RSAKeyParameters(false, pubKey.getModulus(), pubKey.getPublicExponent());
        }
        else if (algId.getObjectId().equals(PKCSObjectIdentifiers.dhKeyAgreement)
                 || algId.getObjectId().equals(X9ObjectIdentifiers.dhpublicnumber))
        {
            DHParameter params = new DHParameter((ASN1Sequence)keyInfo.getAlgorithmId().getParameters());
View Full Code Here

Examples of org.bouncycastle.asn1.x509.RSAPublicKeyStructure

                                    /*
                                    * We only support RSA certificates. Lets hope
                                    * this is one.
                                    */
                                    RSAPublicKeyStructure rsaKey = null;
                                    try
                                    {
                                        rsaKey = RSAPublicKeyStructure.getInstance(cert.certs[0].getTBSCertificate().getSubjectPublicKeyInfo().getPublicKey());
                                    }
                                    catch (Exception e)
                                    {
                                        /*
                                        * Sorry, we have to fail ;-(
                                        */
                                        this.failWithError(AL_fatal, AP_unsupported_certificate);
                                    }

                                    /*
                                    * Parse the servers public RSA key.
                                    */
                                    this.serverRsaKey = new RSAKeyParameters(
                                        false,
                                        rsaKey.getModulus(),
                                        rsaKey.getPublicExponent());

                                    connection_state = CS_SERVER_CERTIFICATE_RECEIVED;
                                    read = true;
                                    break;
                                default:
View Full Code Here

Examples of org.bouncycastle.asn1.x509.RSAPublicKeyStructure

    {
        ByteArrayInputStream bAIS = new ByteArrayInputStream(readBytes(endMarker));
        ASN1InputStream ais = new ASN1InputStream(bAIS);
        Object asnObject = ais.readObject();
        ASN1Sequence sequence = (ASN1Sequence) asnObject;
        RSAPublicKeyStructure rsaPubStructure = new RSAPublicKeyStructure(sequence);
        RSAPublicKeySpec keySpec = new RSAPublicKeySpec(
                    rsaPubStructure.getModulus(),
                    rsaPubStructure.getPublicExponent());

        try
        {
            KeyFactory keyFact = KeyFactory.getInstance("RSA", provider);
View Full Code Here

Examples of org.bouncycastle.asn1.x509.RSAPublicKeyStructure

        AlgorithmIdentifier     algId = keyInfo.getAlgorithmId();
       
        if (algId.getObjectId().equals(PKCSObjectIdentifiers.rsaEncryption)
            || algId.getObjectId().equals(X509ObjectIdentifiers.id_ea_rsa))
        {
            RSAPublicKeyStructure   pubKey = new RSAPublicKeyStructure((ASN1Sequence)keyInfo.getPublicKey());

            return new RSAKeyParameters(false, pubKey.getModulus(), pubKey.getPublicExponent());
        }
        else if (algId.getObjectId().equals(PKCSObjectIdentifiers.dhKeyAgreement)
                 || algId.getObjectId().equals(X9ObjectIdentifiers.dhpublicnumber))
        {
            DHParameter params = new DHParameter((ASN1Sequence)keyInfo.getAlgorithmId().getParameters());
View Full Code Here

Examples of org.bouncycastle.asn1.x509.RSAPublicKeyStructure

                                    /*
                                    * We only support RSA certificates. Lets hope
                                    * this is one.
                                    */
                                    RSAPublicKeyStructure rsaKey = null;
                                    try
                                    {
                                        rsaKey = RSAPublicKeyStructure.getInstance(cert.certs[0].getTBSCertificate().getSubjectPublicKeyInfo().getPublicKey());
                                    }
                                    catch (Exception e)
                                    {
                                        /*
                                        * Sorry, we have to fail ;-(
                                        */
                                        this.failWithError(AL_fatal, AP_unsupported_certificate);
                                    }

                                    /*
                                    * Parse the servers public RSA key.
                                    */
                                    this.serverRsaKey = new RSAKeyParameters(
                                        false,
                                        rsaKey.getModulus(),
                                        rsaKey.getPublicExponent());

                                    connection_state = CS_SERVER_CERTIFICATE_RECEIVED;
                                    read = true;
                                    break;
                                default:
View Full Code Here

Examples of org.bouncycastle2.asn1.x509.RSAPublicKeyStructure

    JCERSAPublicKey(
        SubjectPublicKeyInfo    info)
    {
        try
        {
            RSAPublicKeyStructure   pubKey = new RSAPublicKeyStructure((ASN1Sequence)info.getPublicKey());

            this.modulus = pubKey.getModulus();
            this.publicExponent = pubKey.getPublicExponent();
        }
        catch (IOException e)
        {
            throw new IllegalArgumentException("invalid info structure in RSA public key");
        }
View Full Code Here

Examples of org.bouncycastle2.asn1.x509.RSAPublicKeyStructure

        return "X.509";
    }

    public byte[] getEncoded()
    {
        SubjectPublicKeyInfo    info = new SubjectPublicKeyInfo(new AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, new DERNull()), new RSAPublicKeyStructure(getModulus(), getPublicExponent()).getDERObject());

        return info.getDEREncoded();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.