Example usage for java.security.interfaces RSAPrivateCrtKey getPrimeExponentQ

List of usage examples for java.security.interfaces RSAPrivateCrtKey getPrimeExponentQ

Introduction

In this page you can find the example usage for java.security.interfaces RSAPrivateCrtKey getPrimeExponentQ.

Prototype

public BigInteger getPrimeExponentQ();

Source Link

Document

Returns the primeExponentQ.

Usage

From source file:com.thoughtworks.go.security.X509CertificateGeneratorTest.java

@Test
public void shouldGeneratePrivateKeyWithCRTFactorsForCompatibilityWithOtherPlatform() throws Exception {
    X509CertificateGenerator generator = new X509CertificateGenerator();
    Registration registration = generator.createAgentCertificate(keystore, "agentHostName");
    assertThat(registration.getPrivateKey(), instanceOf(RSAPrivateCrtKey.class));
    RSAPrivateCrtKey key = (RSAPrivateCrtKey) registration.getPrivateKey();
    assertThat(key.getModulus().signum(), is(1));
    assertThat(key.getPrivateExponent().signum(), is(1));
    assertThat(key.getPrimeP().signum(), is(1));
    assertThat(key.getPrimeExponentQ().signum(), is(1));
    assertThat(key.getCrtCoefficient().signum(), is(1));
}

From source file:org.ebayopensource.fido.uaf.crypto.KeyCodec.java

static public RSAKeyParameters generatePrivateKeyParameter(RSAPrivateKey key) {
    if (key instanceof RSAPrivateCrtKey) {
        RSAPrivateCrtKey k = (RSAPrivateCrtKey) key;
        return new RSAPrivateCrtKeyParameters(k.getModulus(), k.getPublicExponent(), k.getPrivateExponent(),
                k.getPrimeP(), k.getPrimeQ(), k.getPrimeExponentP(), k.getPrimeExponentQ(),
                k.getCrtCoefficient());/*from  www .  j  a va  2  s  .co m*/
    } else {
        RSAPrivateKey k = key;
        return new RSAKeyParameters(true, k.getModulus(), k.getPrivateExponent());
    }
}