mirror of
				https://github.com/gregtwallace/apc-p15-tool.git
				synced 2025-11-03 23:57:33 +00:00 
			
		
		
		
	key: finish key encoding and start cert
This commit is contained in:
		
					parent
					
						
							
								85462c93b1
							
						
					
				
			
			
				commit
				
					
						1f6dad4907
					
				
			
		
					 14 changed files with 592 additions and 115 deletions
				
			
		pkg/tools/asn1obj
| 
						 | 
				
			
			@ -15,3 +15,20 @@ func Integer(bigInt *big.Int) []byte {
 | 
			
		|||
 | 
			
		||||
	return asn1result
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// IntegerExplicitValue returns bigInt encoded as an Integer, however
 | 
			
		||||
// instead of tagging it with Integer it is instead tagged with an
 | 
			
		||||
// explicit tag of the specified tag number
 | 
			
		||||
func IntegerExplicitValue(explicitTagNumber int, bigInt *big.Int) []byte {
 | 
			
		||||
	intBytes := Integer(bigInt)
 | 
			
		||||
 | 
			
		||||
	asn1Obj := asn1.RawValue{}
 | 
			
		||||
	rest, err := asn1.Unmarshal(intBytes, &asn1Obj)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		panic(err)
 | 
			
		||||
	} else if len(rest) > 0 {
 | 
			
		||||
		panic("invalid extra data")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return ExplicitValue(explicitTagNumber, asn1Obj.Bytes)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue