Hello,
I am cloning an app following ATMEL guidelines.
I need to clone this app: https://play.google.com/store/apps/details?id=net.nanmu.atmel.smartplug
This app configures and operates this ATMEL reference design device : http://www.atmel.com/tools/smart-plug-reference-design.aspx
The problem is that ATMEL release _everything_ (PCB, schematic, even BOM and firmware source) about this design, but they refuse to give the sources of the app.
So, I need to make it from scratch.
The most difficult part is to ensure excrypted communication with the ATECC508A chip: http://www.atmel.com/devices/ATECC508A.aspx
what i need now is to create a Elliptic curve key pair.
I found that in Android this is done through the piece of code described at this page: https://developer.android.com/reference/android/security/keystore/KeyGenParameterSpec.html
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
Since I am not still very proficient in Reflection, I need help in turning this piece of conde inside B4A
I attached the whole communication process schematic.
I can follow all of the async communication.
Please, help.
Regards,
Pierpaolo
			
			I am cloning an app following ATMEL guidelines.
I need to clone this app: https://play.google.com/store/apps/details?id=net.nanmu.atmel.smartplug
This app configures and operates this ATMEL reference design device : http://www.atmel.com/tools/smart-plug-reference-design.aspx
The problem is that ATMEL release _everything_ (PCB, schematic, even BOM and firmware source) about this design, but they refuse to give the sources of the app.
So, I need to make it from scratch.
The most difficult part is to ensure excrypted communication with the ATECC508A chip: http://www.atmel.com/devices/ATECC508A.aspx
what i need now is to create a Elliptic curve key pair.
I found that in Android this is done through the piece of code described at this page: https://developer.android.com/reference/android/security/keystore/KeyGenParameterSpec.html
			
				B4X:
			
		
		
		 KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(
         KeyProperties.KEY_ALGORITHM_EC, "AndroidKeyStore");
keyPairGenerator.initialize(
         new KeyGenParameterSpec.Builder(
                 "key1",
                 KeyProperties.PURPOSE_SIGN)
                 .setAlgorithmParameterSpec(new ECGenParameterSpec("secp256r1"))
                 .setDigests(KeyProperties.DIGEST_SHA256,
                         KeyProperties.DIGEST_SHA384,
                         KeyProperties.DIGEST_SHA512)
                 // Only permit the private key to be used if the user authenticated
                 // within the last five minutes.
                 .setUserAuthenticationRequired(true)
                 .setUserAuthenticationValidityDurationSeconds(5 * 60)
                 .build());
KeyPair keyPair = keyPairGenerator.generateKeyPair();
Signature signature = Signature.getInstance("SHA256withECDSA");
signature.initSign(keyPair.getPrivate());
...
// The key pair can also be obtained from the Android Keystore any time as follows:
KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore");
keyStore.load(null);
PrivateKey privateKey = (PrivateKey) keyStore.getKey("key1", null);
PublicKey publicKey = keyStore.getCertificate("key1").getPublicKey();Since I am not still very proficient in Reflection, I need help in turning this piece of conde inside B4A
I attached the whole communication process schematic.
I can follow all of the async communication.
Please, help.
Regards,
Pierpaolo
Attachments
			
				Last edited: 
			
		
	
								
								
									
	
								
							
							 
				 
			 
 
		 
 
		 
 
		 
 
		