Example usage for java.security.interfaces RSAKey getModulus

List of usage examples for java.security.interfaces RSAKey getModulus

Introduction

In this page you can find the example usage for java.security.interfaces RSAKey getModulus.

Prototype

public BigInteger getModulus();

Source Link

Document

Returns the modulus.

Usage

From source file:Test.java

public boolean permits(Set<CryptoPrimitive> primitives, String algorithm, Key key,
            AlgorithmParameters parameters) {
        if (algorithm == null)
            algorithm = key.getAlgorithm();

        if (algorithm.indexOf("RSA") == -1)
            return false;

        if (key != null) {
            RSAKey rsaKey = (RSAKey) key;
            int size = rsaKey.getModulus().bitLength();
            if (size < 2048)
                return false;
        }/*from w w w . j  av a2s .  c  o  m*/

        return true;
    }