ECPublicKey

public class ECPublicKey : CustomStringConvertible

An Elliptic Curve public key

Initializers

  • Creates a public key

    Throws

    An exception if w is not on the curve or is infinity

    Declaration

    Swift

    public init(domain: Domain, w: Point) throws

    Parameters

    domain

    The domain the key belongs to

    w

    The public key value - a curve point

  • Creates a public key from its DER encoding

    Throws

    An exception if the DER encoding is wrong

    Declaration

    Swift

    public convenience init(der: Bytes) throws

    Parameters

    der

    The DER encoding of the key

  • Creates a public key from its PEM encoding

    Throws

    An exception if the PEM encoding is wrong

    Declaration

    Swift

    public convenience init(pem: String) throws

    Parameters

    pem

    The PEM encoding of the key

Stored Properties

  • The domain the key belongs to

    Declaration

    Swift

    public let domain: Domain
  • w

    The public value - a curve point

    Declaration

    Swift

    public let w: Point

Computed Properties

  • The ASN1 encoding of self

    Declaration

    Swift

    public var asn1: ASN1 { get }
  • pem

    The PEM encoding of self

    Declaration

    Swift

    public var pem: String { get }
  • A textual representation of the ASN1 encoding of self

    Declaration

    Swift

    public var description: String { get }

Instance Methods

  • Verifies a signature with ECDSA

    Declaration

    Swift

    public func verify(signature: ECSignature, msg: Bytes, bw: Int? = nil) -> Bool

    Parameters

    signature

    The signature to verify

    msg

    The message to verify signature for

    bw

    Optional bitwidth used to select the proper message digest. By default the domain field size is used

    Return Value

    true iff the signature is verified

  • Verifies a signature with ECDSA

    Declaration

    Swift

    public func verify(signature: ECSignature, msg: Data, bw: Int? = nil) -> Bool

    Parameters

    signature

    The signature to verify

    msg

    The message to verify signature for

    bw

    Optional bitwidth used to select the proper message digest. By default the domain field size is used

    Return Value

    true iff the signature is verified

  • Encrypts a byte array with ECIES

    Declaration

    Swift

    public func encrypt(msg: Bytes, cipher: AESCipher, mode: BlockMode = .GCM) -> Bytes

    Parameters

    msg

    The bytes to encrypt

    cipher

    The AES cipher to use

    mode

    The block mode to use - GCM is default

    Return Value

    The encrypted message

  • Encrypts a Data structure with ECIES

    Declaration

    Swift

    public func encrypt(msg: Data, cipher: AESCipher, mode: BlockMode = .GCM) -> Data

    Parameters

    msg

    The data to encrypt

    cipher

    The AES cipher to use

    mode

    The block mode to use - GCM is default

    Return Value

    The encrypted message