Class LazyECPoint


  • public class LazyECPoint
    extends java.lang.Object
    A wrapper around a SECP256K1 ECPoint that delays decoding of the point for as long as possible. This is useful because point encode/decode in Bouncy Castle is quite slow especially on Dalvik, as it often involves decompression/recompression.
    • Constructor Summary

      Constructors 
      Constructor Description
      LazyECPoint​(byte[] bits)
      Construct a LazyECPoint from a public key.
      LazyECPoint​(org.bouncycastle.math.ec.ECCurve curve, byte[] bits)
      Deprecated.
      LazyECPoint​(org.bouncycastle.math.ec.ECPoint point, boolean compressed)
      Construct a LazyECPoint from an already decoded point.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.bouncycastle.math.ec.ECPoint add​(org.bouncycastle.math.ec.ECPoint b)  
      LazyECPoint compress()
      Returns a compressed version of this elliptic curve point.
      LazyECPoint decompress()
      Returns a decompressed version of this elliptic curve point.
      boolean equals​(java.lang.Object o)  
      boolean equals​(org.bouncycastle.math.ec.ECPoint other)  
      org.bouncycastle.math.ec.ECPoint get()  
      org.bouncycastle.math.ec.ECFieldElement getAffineXCoord()  
      org.bouncycastle.math.ec.ECFieldElement getAffineYCoord()  
      org.bouncycastle.math.ec.ECCurve getCurve()  
      org.bouncycastle.math.ec.ECPoint getDetachedPoint()  
      byte[] getEncoded()  
      byte[] getEncoded​(boolean compressed)  
      org.bouncycastle.math.ec.ECFieldElement getX()  
      org.bouncycastle.math.ec.ECFieldElement getXCoord()  
      org.bouncycastle.math.ec.ECFieldElement getY()  
      org.bouncycastle.math.ec.ECFieldElement getYCoord()  
      org.bouncycastle.math.ec.ECFieldElement getZCoord​(int index)  
      org.bouncycastle.math.ec.ECFieldElement[] getZCoords()  
      int hashCode()  
      boolean isCompressed()  
      boolean isInfinity()  
      boolean isNormalized()  
      boolean isValid()  
      org.bouncycastle.math.ec.ECPoint multiply​(java.math.BigInteger k)  
      org.bouncycastle.math.ec.ECPoint negate()  
      org.bouncycastle.math.ec.ECPoint normalize()  
      org.bouncycastle.math.ec.ECPoint scaleX​(org.bouncycastle.math.ec.ECFieldElement scale)  
      org.bouncycastle.math.ec.ECPoint scaleY​(org.bouncycastle.math.ec.ECFieldElement scale)  
      org.bouncycastle.math.ec.ECPoint subtract​(org.bouncycastle.math.ec.ECPoint b)  
      org.bouncycastle.math.ec.ECPoint threeTimes()  
      org.bouncycastle.math.ec.ECPoint timesPow2​(int e)  
      org.bouncycastle.math.ec.ECPoint twice()  
      org.bouncycastle.math.ec.ECPoint twicePlus​(org.bouncycastle.math.ec.ECPoint b)  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LazyECPoint

        public LazyECPoint​(byte[] bits)
        Construct a LazyECPoint from a public key. Due to the delayed decoding of the point the validation of the public key is delayed too, e.g. until a getter is called.
        Parameters:
        bits - public key bytes
      • LazyECPoint

        @Deprecated
        public LazyECPoint​(org.bouncycastle.math.ec.ECCurve curve,
                           byte[] bits)
        Deprecated.
        Construct a LazyECPoint from a public key. Due to the delayed decoding of the point the validation of the public key is delayed too, e.g. until a getter is called.
        Parameters:
        curve - a curve the point is on
        bits - public key bytes
      • LazyECPoint

        public LazyECPoint​(org.bouncycastle.math.ec.ECPoint point,
                           boolean compressed)
        Construct a LazyECPoint from an already decoded point.
        Parameters:
        point - the wrapped point
        compressed - true if the represented public key is compressed
    • Method Detail

      • compress

        public LazyECPoint compress()
        Returns a compressed version of this elliptic curve point. Returns the same point if it's already compressed. See the ECKey class docs for a discussion of point compression.
      • decompress

        public LazyECPoint decompress()
        Returns a decompressed version of this elliptic curve point. Returns the same point if it's already compressed. See the ECKey class docs for a discussion of point compression.
      • get

        public org.bouncycastle.math.ec.ECPoint get()
      • getEncoded

        public byte[] getEncoded()
      • getDetachedPoint

        public org.bouncycastle.math.ec.ECPoint getDetachedPoint()
      • isInfinity

        public boolean isInfinity()
      • timesPow2

        public org.bouncycastle.math.ec.ECPoint timesPow2​(int e)
      • getYCoord

        public org.bouncycastle.math.ec.ECFieldElement getYCoord()
      • getZCoords

        public org.bouncycastle.math.ec.ECFieldElement[] getZCoords()
      • isNormalized

        public boolean isNormalized()
      • isCompressed

        public boolean isCompressed()
      • multiply

        public org.bouncycastle.math.ec.ECPoint multiply​(java.math.BigInteger k)
      • subtract

        public org.bouncycastle.math.ec.ECPoint subtract​(org.bouncycastle.math.ec.ECPoint b)
      • isValid

        public boolean isValid()
      • scaleY

        public org.bouncycastle.math.ec.ECPoint scaleY​(org.bouncycastle.math.ec.ECFieldElement scale)
      • getXCoord

        public org.bouncycastle.math.ec.ECFieldElement getXCoord()
      • scaleX

        public org.bouncycastle.math.ec.ECPoint scaleX​(org.bouncycastle.math.ec.ECFieldElement scale)
      • equals

        public boolean equals​(org.bouncycastle.math.ec.ECPoint other)
      • negate

        public org.bouncycastle.math.ec.ECPoint negate()
      • threeTimes

        public org.bouncycastle.math.ec.ECPoint threeTimes()
      • getZCoord

        public org.bouncycastle.math.ec.ECFieldElement getZCoord​(int index)
      • getEncoded

        public byte[] getEncoded​(boolean compressed)
      • add

        public org.bouncycastle.math.ec.ECPoint add​(org.bouncycastle.math.ec.ECPoint b)
      • twicePlus

        public org.bouncycastle.math.ec.ECPoint twicePlus​(org.bouncycastle.math.ec.ECPoint b)
      • getCurve

        public org.bouncycastle.math.ec.ECCurve getCurve()
      • normalize

        public org.bouncycastle.math.ec.ECPoint normalize()
      • getY

        public org.bouncycastle.math.ec.ECFieldElement getY()
      • twice

        public org.bouncycastle.math.ec.ECPoint twice()
      • getAffineYCoord

        public org.bouncycastle.math.ec.ECFieldElement getAffineYCoord()
      • getAffineXCoord

        public org.bouncycastle.math.ec.ECFieldElement getAffineXCoord()
      • getX

        public org.bouncycastle.math.ec.ECFieldElement getX()
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object