public DEROtherInfo generate() { if (used) { throw new IllegalStateException("builder already used"); } used = true; return otherInfoBuilder.build(); } }
public DEROtherInfo generate(byte[] suppPrivInfoPartB) { if (used) { throw new IllegalStateException("builder already used"); } used = true; this.otherInfoBuilder.withSuppPrivInfo(agreement.calculateAgreement(NHOtherInfoGenerator.getPublicKey(suppPrivInfoPartB))); return otherInfoBuilder.build(); } }
/** * Create a basic builder with just the compulsory fields. * * @param algorithmID the algorithm associated with this invocation of the KDF. * @param partyUInfo sender party info. * @param partyVInfo receiver party info. * @param random a source of randomness. */ public NHOtherInfoGenerator(AlgorithmIdentifier algorithmID, byte[] partyUInfo, byte[] partyVInfo, SecureRandom random) { this.otherInfoBuilder = new DEROtherInfo.Builder(algorithmID, partyUInfo, partyVInfo); this.random = random; }
public byte[] getSuppPrivInfoPartB(byte[] suppPrivInfoPartA) { NHExchangePairGenerator exchGen = new NHExchangePairGenerator(random); ExchangePair bEp = exchGen.generateExchange(getPublicKey(suppPrivInfoPartA)); this.otherInfoBuilder.withSuppPrivInfo(bEp.getSharedValue()); return getEncoded((NHPublicKeyParameters)bEp.getPublicKey()); }
/** * Add optional supplementary public info (DER tagged, implicit, 0). * * @param suppPubInfo supplementary public info. * @return the current builder instance. */ public NHOtherInfoGenerator withSuppPubInfo(byte[] suppPubInfo) { this.otherInfoBuilder.withSuppPubInfo(suppPubInfo); return this; }
/** * Add optional supplementary public info (DER tagged, implicit, 0). * * @param suppPubInfo supplementary public info. * @return the current builder instance. */ public NHOtherInfoGenerator withSuppPubInfo(byte[] suppPubInfo) { this.otherInfoBuilder.withSuppPubInfo(suppPubInfo); return this; }