/** * @return the length of the code */ public int getN() { return params.getN(); }
public int getKeySize(McElieceCCA2KeyParameters key) throws IllegalArgumentException { if (key instanceof McElieceCCA2PublicKeyParameters) { return ((McElieceCCA2PublicKeyParameters)key).getN(); } if (key instanceof McElieceCCA2PrivateKeyParameters) { return ((McElieceCCA2PrivateKeyParameters)key).getN(); } throw new IllegalArgumentException("unsupported type"); }
public int getKeySize(McElieceCCA2KeyParameters key) throws IllegalArgumentException { if (key instanceof McElieceCCA2PublicKeyParameters) { return ((McElieceCCA2PublicKeyParameters)key).getN(); } if (key instanceof McElieceCCA2PrivateKeyParameters) { return ((McElieceCCA2PrivateKeyParameters)key).getN(); } throw new IllegalArgumentException("unsupported type"); }
/** * Return the key size of the given key object. * * @param key the McElieceCCA2KeyParameters object * @return the key size of the given key object */ public int getKeySize(McElieceCCA2KeyParameters key) { if (key instanceof McElieceCCA2PublicKeyParameters) { return ((McElieceCCA2PublicKeyParameters)key).getN(); } if (key instanceof McElieceCCA2PrivateKeyParameters) { return ((McElieceCCA2PrivateKeyParameters)key).getN(); } throw new IllegalArgumentException("unsupported type"); }
/** * Return the key size of the given key object. * * @param key the McElieceCCA2KeyParameters object * @return the key size of the given key object */ public int getKeySize(McElieceCCA2KeyParameters key) { if (key instanceof McElieceCCA2PublicKeyParameters) { return ((McElieceCCA2PublicKeyParameters)key).getN(); } if (key instanceof McElieceCCA2PrivateKeyParameters) { return ((McElieceCCA2PrivateKeyParameters)key).getN(); } throw new IllegalArgumentException("unsupported type"); }
/** * Return the key size of the given key object. * * @param key the McElieceCCA2KeyParameters object * @return the key size of the given key object * @throws IllegalArgumentException if the key is invalid */ public int getKeySize(McElieceCCA2KeyParameters key) throws IllegalArgumentException { if (key instanceof McElieceCCA2PublicKeyParameters) { return ((McElieceCCA2PublicKeyParameters)key).getN(); } if (key instanceof McElieceCCA2PrivateKeyParameters) { return ((McElieceCCA2PrivateKeyParameters)key).getN(); } throw new IllegalArgumentException("unsupported type"); }
/** * Return the key size of the given key object. * * @param key the McElieceCCA2KeyParameters object * @return the key size of the given key object * @throws IllegalArgumentException if the key is invalid */ public int getKeySize(McElieceCCA2KeyParameters key) throws IllegalArgumentException { if (key instanceof McElieceCCA2PublicKeyParameters) { return ((McElieceCCA2PublicKeyParameters)key).getN(); } if (key instanceof McElieceCCA2PrivateKeyParameters) { return ((McElieceCCA2PrivateKeyParameters)key).getN(); } throw new IllegalArgumentException("unsupported type"); }
/** * @return a human readable form of the key */ public String toString() { String result = "McEliecePublicKey:\n"; result += " length of the code : " + params.getN() + "\n"; result += " error correction capability: " + params.getT() + "\n"; result += " generator matrix : " + params.getG().toString(); return result; }
/** * @return the hash code of this key */ public int hashCode() { return 37 * (params.getN() + 37 * params.getT()) + params.getG().hashCode(); }
private void initCipherEncrypt(McElieceCCA2PublicKeyParameters pubKey) { this.sr = sr != null ? sr : new SecureRandom(); this.messDigest = pubKey.getParameters().getDigest(); n = pubKey.getN(); k = pubKey.getK(); t = pubKey.getT(); }
public void initCipherEncrypt(McElieceCCA2PublicKeyParameters pubKey) { this.sr = sr != null ? sr : new SecureRandom(); this.messDigest = pubKey.getParameters().getDigest(); n = pubKey.getN(); k = pubKey.getK(); t = pubKey.getT(); }
private void initCipherEncrypt(McElieceCCA2PublicKeyParameters pubKey) { this.messDigest = pubKey.getParameters().getDigest(); n = pubKey.getN(); k = pubKey.getK(); t = pubKey.getT(); }
private void initCipherEncrypt(McElieceCCA2PublicKeyParameters pubKey) { this.messDigest = Utils.getDigest(pubKey.getDigest()); n = pubKey.getN(); k = pubKey.getK(); t = pubKey.getT(); }
private void initCipherEncrypt(McElieceCCA2PublicKeyParameters pubKey) { this.sr = sr != null ? sr : CryptoServicesRegistrar.getSecureRandom(); this.messDigest = Utils.getDigest(pubKey.getDigest()); n = pubKey.getN(); k = pubKey.getK(); t = pubKey.getT(); }
private void initCipherEncrypt(McElieceCCA2PublicKeyParameters pubKey) { this.sr = sr != null ? sr : CryptoServicesRegistrar.getSecureRandom(); this.messDigest = Utils.getDigest(pubKey.getDigest()); n = pubKey.getN(); k = pubKey.getK(); t = pubKey.getT(); }
/** * Compare this key with another object. * * @param other the other object * @return the result of the comparison */ public boolean equals(Object other) { if (other == null || !(other instanceof BCMcElieceCCA2PublicKey)) { return false; } BCMcElieceCCA2PublicKey otherKey = (BCMcElieceCCA2PublicKey)other; return (params.getN() == otherKey.getN()) && (params.getT() == otherKey.getT()) && (params.getG().equals(otherKey.getG())); }
/** * Return the keyData to encode in the SubjectPublicKeyInfo structure. * <p> * The ASN.1 definition of the key structure is * <pre> * McEliecePublicKey ::= SEQUENCE { * n Integer -- length of the code * t Integer -- error correcting capability * matrixG OctetString -- generator matrix as octet string * } * </pre> * @return the keyData to encode in the SubjectPublicKeyInfo structure */ public byte[] getEncoded() { McElieceCCA2PublicKey key = new McElieceCCA2PublicKey(params.getN(), params.getT(), params.getG(), Utils.getDigAlgId(params.getDigest())); AlgorithmIdentifier algorithmIdentifier = new AlgorithmIdentifier(PQCObjectIdentifiers.mcElieceCca2); try { SubjectPublicKeyInfo subjectPublicKeyInfo = new SubjectPublicKeyInfo(algorithmIdentifier, key); return subjectPublicKeyInfo.getEncoded(); } catch (IOException e) { return null; } }