Share My Creation SPC Analytics Tool [CNC]

Hi,

just finished a really awesome SPC Analytics Tool for my work. This is such a powerful tool and a must for every manufacture. Everyone is amazed by the outcome and i am so glad i did it in B4j :)

what do you think guys?



1769021144804.png
 
Last edited:

ilan

Expert
Licensed User
Longtime User
Well done Ilan!

Please share some details - database? frontend framework?
thanks Erel.

All logic (backend happens in b4j using Server Handler only - no websocket) the frontend is written in pure html,css,js.
b4j is handling all the request and providing data via json objects and the drawing only is happening in the front end.

framework i use:

- Bootstrap
- Chart,js
- SweetAlert 2

i dont use a database all calculation are read from local files created by CMM machines in csv format. so i parse all data from those reports and use them in b4j.

i also implemented license manager via openssl 2048bit RSA key. i create the license via php because i could not figure out how to do it via b4j so only creating the license is done via php but reading and handling the license all is done from the server.

this is how i verify the license via b4j using javaobject:


B4X:
Sub VerifyRSASignature(Data As String, SignatureBase64 As String, PublicKeyPEM As String) As Boolean
    Dim su As StringUtils

    ' Decode signature
    Dim sigBytes() As Byte = su.DecodeBase64(SignatureBase64)
    Dim dataBytes() As Byte = Data.GetBytes("UTF8")

    ' Clean PEM
    PublicKeyPEM = PublicKeyPEM.Replace("-----BEGIN PUBLIC KEY-----", "")
    PublicKeyPEM = PublicKeyPEM.Replace("-----END PUBLIC KEY-----", "")
    PublicKeyPEM = PublicKeyPEM.Replace(Chr(10), "")
    PublicKeyPEM = PublicKeyPEM.Replace(Chr(13), "")

    Dim keyBytes() As Byte = su.DecodeBase64(PublicKeyPEM)

    ' Create X509EncodedKeySpec using constructor
    Dim joKeySpec As JavaObject
    joKeySpec.InitializeNewInstance("java.security.spec.X509EncodedKeySpec", Array(keyBytes))

    ' Create RSA public key
    Dim joKeyFactory As JavaObject
    joKeyFactory = joKeyFactory.InitializeStatic("java.security.KeyFactory").RunMethod("getInstance", Array("RSA"))
    Dim pubKey As JavaObject = joKeyFactory.RunMethod("generatePublic", Array(joKeySpec))

    ' Verify signature
    Dim joSig As JavaObject
    joSig = joSig.InitializeStatic("java.security.Signature").RunMethod("getInstance", Array("SHA256withRSA"))
    joSig.RunMethod("initVerify", Array(pubKey))
    joSig.RunMethod("update", Array(dataBytes))

    Return joSig.RunMethod("verify", Array(sigBytes))
End Sub

love the result :)
 
Last edited:
Top