Search in sources :

Example 1 with BCRSAPublicKey

use of org.bouncycastle.jcajce.provider.asymmetric.rsa.BCRSAPublicKey in project oxAuth by GluuFederation.

the class Certificate method getRsaPublicKey.

public RSAPublicKey getRsaPublicKey() {
    RSAPublicKey rsaPublicKey = null;
    if (x509Certificate != null && x509Certificate.getPublicKey() instanceof BCRSAPublicKey) {
        BCRSAPublicKey publicKey = (BCRSAPublicKey) x509Certificate.getPublicKey();
        rsaPublicKey = new RSAPublicKey(publicKey.getModulus(), publicKey.getPublicExponent());
    }
    return rsaPublicKey;
}
Also used : RSAPublicKey(org.xdi.oxauth.model.crypto.signature.RSAPublicKey) BCRSAPublicKey(org.bouncycastle.jcajce.provider.asymmetric.rsa.BCRSAPublicKey) BCRSAPublicKey(org.bouncycastle.jcajce.provider.asymmetric.rsa.BCRSAPublicKey)

Example 2 with BCRSAPublicKey

use of org.bouncycastle.jcajce.provider.asymmetric.rsa.BCRSAPublicKey in project oxAuth by GluuFederation.

the class Certificate method getPublicKey.

public PublicKey getPublicKey() {
    PublicKey publicKey = null;
    if (x509Certificate != null && x509Certificate.getPublicKey() instanceof BCRSAPublicKey) {
        BCRSAPublicKey jcersaPublicKey = (BCRSAPublicKey) x509Certificate.getPublicKey();
        publicKey = new RSAPublicKey(jcersaPublicKey.getModulus(), jcersaPublicKey.getPublicExponent());
    } else if (x509Certificate != null && x509Certificate.getPublicKey() instanceof BCECPublicKey) {
        BCECPublicKey jceecPublicKey = (BCECPublicKey) x509Certificate.getPublicKey();
        publicKey = new ECDSAPublicKey(signatureAlgorithm, jceecPublicKey.getQ().getX().toBigInteger(), jceecPublicKey.getQ().getY().toBigInteger());
    }
    return publicKey;
}
Also used : RSAPublicKey(org.xdi.oxauth.model.crypto.signature.RSAPublicKey) BCRSAPublicKey(org.bouncycastle.jcajce.provider.asymmetric.rsa.BCRSAPublicKey) BCECPublicKey(org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPublicKey) RSAPublicKey(org.xdi.oxauth.model.crypto.signature.RSAPublicKey) BCRSAPublicKey(org.bouncycastle.jcajce.provider.asymmetric.rsa.BCRSAPublicKey) ECDSAPublicKey(org.xdi.oxauth.model.crypto.signature.ECDSAPublicKey) BCECPublicKey(org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPublicKey) BCRSAPublicKey(org.bouncycastle.jcajce.provider.asymmetric.rsa.BCRSAPublicKey) ECDSAPublicKey(org.xdi.oxauth.model.crypto.signature.ECDSAPublicKey)

Aggregations

BCRSAPublicKey (org.bouncycastle.jcajce.provider.asymmetric.rsa.BCRSAPublicKey)2 RSAPublicKey (org.xdi.oxauth.model.crypto.signature.RSAPublicKey)2 BCECPublicKey (org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPublicKey)1 ECDSAPublicKey (org.xdi.oxauth.model.crypto.signature.ECDSAPublicKey)1