Skip to main content

Posts

Showing posts from 2021

GoF Design Patterns

Design Patterns listed out in GoF  Creational Pattern Abstract Factory Builder Factory Method Prototype Singleton Structural Pattern Adaptor Bridge Composite Decorator Facade Flyweight Proxy Behavioral Pattern Chain of Resposibility Command Interpreter Iterator Mediator Momento Observer State Strategy Template Method Visitor

Secugen Hamster Fingerprint reader API cannot function without the device

For those who are familiar with Secugen Devices, might know that there are two function calls to initialize the device API.   The Init(long devName) and  The InitEx(long width, long height, long dpi) As per the official Javadoc, the first one is meant to " Initialize the SecuGen libraries using attached SecuGen fingerprint sensor. This method should be called after Open() is called."  while the second one is for " Initializes the SecuGen libraries using image parameters. Only 8bits per pixel raw images are supported."  For the same function, the C++ documentation says , "Use when running fingerprint algorithm module without a SecuGen reader." I had a use case wherein, I want to do the fingerprint verification/matching at server-side. This made me wonder if I can use the second initialization function at the server end without the device and use the fingerprint matching APIs. I tried using the aforementioned approach, but the InitEx() method was failing ...

PostgreSQL with SSL auth (Java client)

PostgreSQL Server 1. Generate certificates Download easyrsa2 from github and extract it   # ./easyrsa build-ca # ./easyrsa build-server-full postgresql-server # ./easyrsa build-client-full postgresql-client   This will generate ca.crt in pki folder, postgres-server.crt , postgres-client.crt in pki/issued folder and postgres-server.key and postgres-client.key in pki/private folder.   PostgreSQL JDBC library cannot read .key file, which is why we have to convert the key to DER format (.pk8) file.   openssl pkcs8 -topk8 -outform DER -in postgres-client.key -out postgres-client.key.pk8 -nocrypt    Give proper unix permissions to the certificates and keys, for eg.   # chown postgres:postgres postgres-server.key  # chown postgres:postgres postgres-server.crt # chmod go-r postgres-server.key     2. Edit postgresql.conf ssl = on          ssl_cert_file = '/opt/postgres-sec/postgres-server.crt...