Example usage for org.bouncycastle.math.ec ECCurve.Fp getFieldSize

List of usage examples for org.bouncycastle.math.ec ECCurve.Fp getFieldSize

Introduction

In this page you can find the example usage for org.bouncycastle.math.ec ECCurve.Fp getFieldSize.

Prototype

public abstract int getFieldSize();

Source Link

Usage

From source file:service.ACService.java

License:Open Source License

/**
 * Construct a number of private attribute keys for the given curve
 */// ww  w .  j  a v  a 2  s .c  o m
static private BigInteger[] constructPrivateAttributeKeys(ECCurve.Fp curve) {
    BigInteger[] private_key;

    private_key = new BigInteger[4];
    switch (curve.getFieldSize()) {
    case 128:
        private_key[0] = new BigInteger("225372274231985790200027551690655815158");
        private_key[1] = new BigInteger("245101174517207170638066748358856317475");
        private_key[2] = new BigInteger("151090931996779535702545347407601272920");
        private_key[3] = new BigInteger("136791876731881043202558472946915414935");
        break;
    case 160:
        private_key[0] = new BigInteger("330901983855736385735122296827923334307263610761");
        private_key[1] = new BigInteger("186811774159849458934010617336619260142261775654");
        private_key[2] = new BigInteger("200301894953491984814918734560179597654129668224");
        private_key[3] = new BigInteger("750491186790593356184026972752047947855576453650");
        break;
    case 192:
        private_key[0] = new BigInteger("3593628016221464844523691788059997682516891660955827077913");
        private_key[1] = new BigInteger("4464361787165100929465907257058278398048745164767155554885");
        private_key[2] = new BigInteger("2968611473043184454125366431770946774998904765828172704480");
        private_key[3] = new BigInteger("2662731123551621877786553098979283273055334939330269203348");
        break;
    default:
        break;
    }

    return private_key;
}

From source file:terminal.GateClient.java

License:Open Source License

/**
 * Construct a number of private attribute keys for the given curve 
 *///from www.  java2 s.  c o m
static private BigInteger[] constructPrivateAttributeKeys(ECCurve.Fp curve) {
    BigInteger[] private_key;

    if (RANDOMISE) {
        private_key = new BigInteger[ATTRIBUTE_COUNT];
        for (int i = 0; i < ATTRIBUTE_COUNT; i++) {
            byte[] seed = random.generateSeed(curve.getFieldSize());
            private_key[i] = new BigInteger(seed).mod(curve.getQ());
        }
    } else {
        private_key = new BigInteger[4];
        switch (curve.getFieldSize()) {
        case 128:
            private_key[0] = new BigInteger("225372274231985790200027551690655815158");
            private_key[1] = new BigInteger("245101174517207170638066748358856317475");
            private_key[2] = new BigInteger("151090931996779535702545347407601272920");
            private_key[3] = new BigInteger("136791876731881043202558472946915414935");
            break;
        case 160:
            private_key[0] = new BigInteger("330901983855736385735122296827923334307263610761");
            private_key[1] = new BigInteger("186811774159849458934010617336619260142261775654");
            private_key[2] = new BigInteger("200301894953491984814918734560179597654129668224");
            private_key[3] = new BigInteger("750491186790593356184026972752047947855576453650");
            break;
        case 192:
            private_key[0] = new BigInteger("3593628016221464844523691788059997682516891660955827077913");
            private_key[1] = new BigInteger("4464361787165100929465907257058278398048745164767155554885");
            private_key[2] = new BigInteger("2968611473043184454125366431770946774998904765828172704480");
            private_key[3] = new BigInteger("2662731123551621877786553098979283273055334939330269203348");
            break;
        default:
            break;
        }
    }

    return private_key;
}